From a0e24a2e8df923e527ed85b75ab041b378ff18ed 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 01/18] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5bb2078..0a0c76c 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 d1b85ddef694ea143f27b352a9bca54f77b07512 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 02/18] 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 0a0c76c..2f86aeb 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 88d79bf..4b06937 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 0000000..58b56b3 --- /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 0000000..6706e21 --- /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 0000000..7c5304e --- /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 0000000..19fc369 --- /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 0000000..036fedf --- /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 0000000..b8ec288 --- /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 0000000..6823192 --- /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 0000000..1148f14 --- /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 0000000..f02a79f --- /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 0000000..5afe530 --- /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 0000000..9933c2a --- /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 0000000..ddb88ec --- /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 0000000..59f3d57 --- /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 0000000..c43f35e --- /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 0000000..bea7107 --- /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 0000000..ce590d5 --- /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 0000000..7122a0d --- /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 0000000..fe55ef0 --- /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 0000000..53593e4 --- /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 0000000..be585cf --- /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 0000000..7d341e4 --- /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 0000000..c0dbee3 --- /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 0000000..42f3457 --- /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 0000000..86283cb --- /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 0000000..d3392fc --- /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 0000000..47bc9f5 --- /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 0000000..4dff921 --- /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 0000000..32451c1 --- /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 0000000..8f84a35 --- /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 0000000..0df755a --- /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 0000000..d658a65 --- /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 0000000..46d294d --- /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 0000000..050474a --- /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 0000000..f2529d8 --- /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 0000000..53cfc41 --- /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 0000000..6890569 --- /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 0000000..e1a18ad --- /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 0000000..7dffe88 --- /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 0000000..c3b7783 --- /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 0000000..09b05a7 --- /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 0000000..327db93 --- /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 0000000..5eb5b1f --- /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 0000000..c768dd7 --- /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 0000000..4e8a7c7 --- /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 0000000..f420d6e --- /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 0000000..9062a51 --- /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 0000000..07cbcbc --- /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 0000000..4cdf38c --- /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 0000000..8e50382 --- /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 0000000..4bbabfa --- /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 0000000..b3023c4 --- /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 0000000..bedc502 --- /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 0000000..47c649a --- /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 0000000..d0e2972 --- /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 0000000..93bd7c8 --- /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 0000000..45d8c98 --- /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 0000000..78f72ce --- /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 0000000..eb363f8 --- /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 0000000..bbc868a --- /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 0000000..40b75c8 --- /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 0000000..e544534 --- /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 0000000..b34eb69 --- /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 0000000..d5b7d58 --- /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 0000000..c2f1856 --- /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 0000000..bafa9dc --- /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 0000000..f6c4900 --- /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 0000000..02fd9e6 --- /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 0000000..9c8a97b --- /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 0000000..72300b6 --- /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 0000000..c34575a --- /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 0000000..a782647 --- /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 0000000..de76148 --- /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 0000000..658a10f --- /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 0000000..4c2daa9 --- /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 0000000..b5e2681 --- /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 0000000..477023e --- /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 0000000..a65b54a --- /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 0000000..b779d32 --- /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 0000000..4fa5331 --- /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 0000000..f6c2d82 --- /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 0000000..19e1583 --- /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 0000000..a72c366 --- /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 0000000..fd9b8fc --- /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 0000000..e9537d3 --- /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 0000000..872688c --- /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 0000000..e5a105f --- /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 0000000..281d9b2 --- /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 0000000..bc8b9ae --- /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 0000000..85bd10e --- /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 0000000..55ddd60 --- /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 0000000..d92e27b --- /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 0000000..7ba9992 --- /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 0000000..f255088 --- /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 0000000..abf1bd8 --- /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 0000000..d64838a --- /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 0000000..7f08c4c --- /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 0000000..eacb2f0 --- /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 0000000..3cd3652 --- /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 0000000..688ed4e --- /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 0000000..d0996d2 --- /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 0000000..c9a5f07 --- /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 0000000..606b67c --- /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 0000000..8d76be7 --- /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 0000000..a9162ee --- /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 0000000..e97261c --- /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 0000000..2197678 --- /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 0000000..5501da4 --- /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 0000000..9dd110b --- /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 0000000..0e8425a --- /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 0000000..1e18b69 --- /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 0000000..c03b5a9 --- /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 0000000..145d8ec --- /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 0000000..04fa8c8 --- /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 0000000..cd63925 --- /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 0000000..73704d8 --- /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 0000000..1642e52 --- /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 0000000..2b932fd --- /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 0000000..1b03460 --- /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 0000000..9d3a77a --- /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 0000000..3b3dd9b --- /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 0000000..3c3c240 --- /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 0000000..55fe503 --- /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 0000000..6d5bb50 --- /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 0000000..2169701 --- /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 0000000..6799040 --- /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 0000000..3665f85 --- /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 0000000..0b6aac2 --- /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 0000000..2cb8a40 --- /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 0000000..633ed16 --- /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 0000000..424dbdf --- /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 0000000..7ed9445 --- /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 0000000..e163d55 --- /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 0000000..4fd43d1 --- /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 0000000..b61fb39 --- /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 0000000..2749842 --- /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 0000000..8df4453 --- /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 0000000..2e62023 --- /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 f7a3ee5f797c5bd286293a69db0b50cd402d56fe 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 03/18] 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 2f86aeb..0115b3b 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 58b56b3..292b75b 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 6706e21..c3d29e8 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 0000000..d69644b --- /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 7ba9992..8297408 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 7c5304e..0000000 --- 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 a833cbb..0590362 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 7e3beeb..c5908ac 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 ca31f7b..f0bf27e 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 036fedf..0000000 --- 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 ddb88ec..7b921c4 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 67b4d01..f55b594 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 59f3d57..61ba1c3 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 0000000..624bfeb --- /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 d915bbb..0000000 --- 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 9933c2a..0000000 --- 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 e64b017..0000000 --- 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 4e7563f..0000000 --- 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 c43f35e..0000000 --- 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 0000000..35d5925 --- /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 0000000..0aada69 --- /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 47bc9f5..c704604 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 0000000..d7261b4 --- /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 7122a0d..0000000 --- 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 fe55ef0..0000000 --- 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 be585cf..0000000 --- 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 7d341e4..0000000 --- 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 c0dbee3..0000000 --- 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 4dff921..0000000 --- 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 d658a65..0000000 --- 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 46d294d..0000000 --- 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 1feee75..c5d50b5 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 d22f74d..0689dc3 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 52190f4..9ff4619 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 42f1c62..a54b4a2 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 22f27d1..231bc5b 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 e1a18ad..9d2a560 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 327db93..b3d95b3 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 a43832c..b9d0b14 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 0000000..fb6e69c --- /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 c3b7783..0000000 --- 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 09b05a7..0000000 --- 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 91db5f7..0000000 --- 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 5eb5b1f..0000000 --- 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 4cdf38c..cf01a7a 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 f02a79f..ce8548e 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 5afe530..ff1c8f9 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 0000000..fe3c9c7 --- /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 4bbabfa..0000000 --- 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 b3023c4..0000000 --- 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 bedc502..0000000 --- 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 47c649a..0000000 --- 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 0000000..e35ffc6 --- /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 93bd7c8..e7335e9 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 0000000..5b03923 --- /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 0000000..c828494 --- /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 ce590d5..9a6a468 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 0000000..8c4af84 --- /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 78f72ce..0000000 --- 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 eb363f8..0000000 --- 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 bbc868a..0000000 --- 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 e544534..0000000 --- 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 b34eb69..0000000 --- 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 d5b7d58..0000000 --- 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 c2f1856..0000000 --- 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 bafa9dc..0000000 --- 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 f6c4900..0000000 --- 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 02fd9e6..0000000 --- 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 9c8a97b..0000000 --- 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 72300b6..0000000 --- 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 c34575a..0000000 --- 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 a782647..0000000 --- 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 de76148..0000000 --- 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 658a10f..0000000 --- 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 4c2daa9..0000000 --- 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 a7cd680..bc94489 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 42f3457..b2b156c 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 904a60b..28d0cf5 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 0c7e8e8..bdc7bce 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 0000000..0d5c999 --- /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 22f4c3c..c092e11 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 72c0401..bff0489 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 5ced1d1..a207f61 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 a4d4b8a..1fcacfb 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 8317076..f77442e 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 0000000..6acbb5c --- /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 0000000..9f80a39 --- /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 a72c366..21c2a85 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 0000000..668aef6 --- /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 fd9b8fc..0000000 --- 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 e9537d3..0000000 --- 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 e5a105f..0000000 --- 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 281d9b2..0000000 --- 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 bc8b9ae..0000000 --- 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 f255088..0000000 --- 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 abf1bd8..0000000 --- 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 7f08c4c..0000000 --- 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 eacb2f0..0000000 --- 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 3cd3652..0000000 --- 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 688ed4e..0000000 --- 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 f734f20..3022233 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 32451c1..61da9c9 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 da8886d..994b9c6 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 0f3fdf3..d58f553 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 0000000..9955d26 --- /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 9d9faed..d71e5bb 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 0cb4164..cb684a9 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 36828ab..38cce8d 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 d4ad6c7..8a70091 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 9dd110b..61bb6ff 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 0e8425a..6e4bf1e 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 1e18b69..a02b5df 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 145d8ec..30635b9 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 0000000..31cb75f --- /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 0000000..4111fc8 --- /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 0000000..9941171 --- /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 0000000..4c0a73c --- /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 cd63925..0000000 --- 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 73704d8..0000000 --- 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 1642e52..0000000 --- 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 1b03460..0000000 --- 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 9d3a77a..0000000 --- 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 3b3dd9b..0000000 --- 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 3c3c240..0000000 --- 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 55fe503..0000000 --- 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 6d5bb50..0000000 --- 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 2169701..0000000 --- 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 6799040..0000000 --- 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 3665f85..0000000 --- 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 0b6aac2..0000000 --- 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 2cb8a40..0000000 --- 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 633ed16..0000000 --- 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 424dbdf..0000000 --- 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 7ed9445..0000000 --- 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 147ef17..9effd28 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 050474a..43da8d7 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 40d3336..14a3614 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 e9f7e1f..1ecb242 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 0000000..0c0ff6b --- /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 0000000..ce54f24 --- /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 0000000..80d0b6b --- /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 0000000..333cfb3 --- /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 18dae57..e785fec 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 4fd43d1..1dda23c 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 b61fb39..aad01ad 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 2749842..a0f78f9 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 8df4453..4aed25e 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 2e62023..ede6963 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 b635a0588edc056550fbf1ddce2a239f4b4b29b2 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 04/18] 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 0115b3b..f52ab5d 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 c067c5a..b8da98d 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 1464af2..ac2dee7 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 c7ad6ad..58d2359 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 d08a8bd..d89de93 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 785afc2..a37ee58 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 54f2cc7..5b36e1e 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 55fa08d..bb991a6 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 45890973be2637f7e69fb82cc5b5e52840420ca1 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 05/18] 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 f52ab5d..75582f8 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 36928ce..35b923d 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 b96c26218eb833e9227dee9551ee9eb2b94b9abd 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 06/18] 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 75582f8..3e4f564 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 f0bf27e..92e7c01 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 3008ad3..44f7b82 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 89f9d46..5e0fba5 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 0000000..815218a --- /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 552dcf8..7d64de7 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 9ff4619..4ae0fca 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 0795f16..474613e 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 c768dd7..585dc95 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 4e8a7c7..2128193 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 0000000..82009e1 --- /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 cbd92c1..84537bd 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 e7335e9..9552664 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 0000000..4cf4df7 --- /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 bdc7bce..1eabecd 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 a207f61..04a020f 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 477023e..8b87f69 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 a65b54a..765a444 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 b779d32..882d163 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 0000000..c37f9b4 --- /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 0000000..894d68c --- /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 d58f553..1c0155e 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 38cce8d..bef89b1 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 c9a5f07..e90007b 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 a02b5df..d2e5441 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 30635b9..0100ff2 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 0000000..430044e --- /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 1ecb242..037af96 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 333cfb3..a02ae7f 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 1dda23c..516d8e3 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 4aed25e..571f0cb 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 16b3c1efb31c9d1da12ab3a2a5e65f4bfcd74247 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 07/18] 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 3e4f564..7e51832 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 cb950aa..f18826d 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 fab93ab..1747205 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 61d8ed4cb6be1d1c2caad265f97987b5e93f620d 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 08/18] 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 7e51832..3840f48 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 f18826d..12aab0e 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 1747205..84a4f8b 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 b6570c0cad69d665d2cce99f57c2b85fb6ff408e 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 09/18] 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 3840f48..e7ac969 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 b8da98d..a0afdcd 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 ac2dee7..94f84b7 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 58d2359..0ac922c 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 eb4932c..92c8710 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 bb991a6..6c2ca76 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 3838f16890d769807271295bb63efba7cec4f8f7 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 10/18] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e7ac969..ea3b8ae 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 d0cec32a5e9a2624607dcd6159ba8f188fe655ca 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 11/18] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ea3b8ae..77807ba 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 142858921f7d536ffec6ef7e923ae36cbcdc8f2c 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 12/18] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 77807ba..cb8d47f 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 559cb22e0982af24e7870744845335328980c49d 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 13/18] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index cb8d47f..a272343 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 d3c55dc909d9431595788c4e140a608e7cea5c5d 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 14/18] 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 a272343..151723e 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 bf4e14c..0410e2e 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 16a3684..0000000 --- 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 1678796..0000000 --- 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 940605f..0000000 --- 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 0ef34b1..0000000 --- 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 f99ac9a..0000000 --- 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 e312347..0000000 --- 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 e4568c2..0000000 --- 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 4169cab..0000000 --- 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 3d95272..0000000 --- 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 4d2134e..0000000 --- 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 1d48570..0000000 --- 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 c958a53..0000000 --- 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 002ac65..0000000 --- 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 9a5543c..0000000 --- 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 a0dd9d3..0000000 --- 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 9718fbd..0000000 --- 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 6f4810d..0000000 --- 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 5247070..0000000 --- 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 1d224b0..0000000 --- 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 a46d7d5..0000000 --- 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 255db91..0000000 --- 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 bd6c1e4..0000000 --- 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 88c559b..0000000 --- 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 d1d1c37..0000000 --- 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 75c7a32..0000000 --- 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 a580c48..0000000 --- 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 3719734..0000000 --- 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 26128b4..0000000 --- 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 02c7875..0000000 --- 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 e97ab2f..0000000 --- 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 27c08ef..0000000 --- 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 76030ba..0000000 --- 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 9b037e7..0000000 --- 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 fcfd7d5..0000000 --- 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 f883356..0000000 --- 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 27ca4f9..0000000 --- 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 00fea71..0000000 --- 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 3f648be..0000000 --- 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 bcb2029..0000000 --- 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 5967139..0000000 --- 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 1a6700b..0000000 --- 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 f8064df..0000000 --- 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 8bedea8..0000000 --- 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 1932047..0000000 --- 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 95cc16c..0000000 --- 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 56b5adc..0000000 --- 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 af0cb0b..0000000 --- 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 54d6c9d..0000000 --- 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 df8802b..0000000 --- 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 56d3855..0000000 --- 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 e99a36e..0000000 --- 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 5371498..0000000 --- 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 8161b3c..0000000 --- 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 f349881..0000000 --- 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 caf12ba..0000000 --- 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 afe72bf..0000000 --- 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 b121f01..0000000 --- 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 325d1c3..0000000 --- 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 2be87f3..0000000 --- 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 efc6227..0000000 --- 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 faeac3d..0000000 --- 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 dcef6d9..0000000 --- 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 3fe79fe..0000000 --- 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 dcc42aa..0000000 --- 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 6a96999..0000000 --- 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 d28ac0d..0000000 --- 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 7137713..0000000 --- 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 a7d34ad..0000000 --- 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 1a0a414..0000000 --- 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 cb308fd..0000000 --- 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 f3396e9..0000000 --- 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 5de9c69..0000000 --- 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 9fdec22..0000000 --- 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 6110e28..0000000 --- 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 bc937d0..0000000 --- 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 46c8abb..0000000 --- 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 c0c8f82..0000000 --- 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 311b6d3..0000000 --- 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 249a414..0000000 --- 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 b0519ad..0000000 --- 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 cb9dd0d..0000000 --- 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 fd1a839..0000000 --- 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 3ad972b..0000000 --- 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 d998e68..0000000 --- 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 2757467..0000000 --- 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 8aa9e3c..0000000 --- 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 9ca6332..0000000 --- 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 f1edefc..0000000 --- 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 23e596f..0000000 --- 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 6ebc151..0000000 --- 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 59bbdf5..0000000 --- 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 290fad4..0000000 --- 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 7449533..0000000 --- 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 41a3aee..82478ee 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 ecd7de9..8746515 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 dc6e601..783850b 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 342ac58..8e5d93d 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 42adeb4..784eff7 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 7ffb24d..73094d2 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 463ac4c..5297c88 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 0b6e140..cb6349e 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 187e24a..62949ac 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 a2aabbb..e2d0217 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 f5f2944..fa42323 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 fb7fc71..0168902 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 ff11a92..ea7635e 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 60fc4dc..0000000 --- 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 cc7f237..0000000 --- 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 9966c76..0000000 --- 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 80ccac2..de2dda4 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 0000000..286d6af --- /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 0000000..79bdffa --- /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 0000000..b127055 --- /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 9295e6c..eff078e 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 8f0dadb..5f1392a 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 8f236c5..de2e549 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 33c37e56e87ef187161361879db3cc25c12e663e 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 15/18] 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 151723e..0ae96ea 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 0410e2e..bf4e14c 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 e0e7672..d316cfd 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 fc4635910c2035f4edffb817e4a7259b82e1c39c 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 16/18] 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 0ae96ea..c36fec2 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 73094d2..64ca1ad 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 0168902..7030cad 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 ea7635e..8ea4db9 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 de2dda4..0082269 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 286d6af..1fdb5ab 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 0000000..615f897 --- /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 0000000..44142c3 --- /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 de2e549..f59410a 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 a109b94c372f554a6f9d6c669dd01fc3afe37c85 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 17/18] 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 c36fec2..f52f430 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 bf4e14c..bb8741f 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 c5280ff..e32f18d 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 0000000..00a6ff9 --- /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 e2d0217..c6d80b7 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 fa42323..58fa3da 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 d316cfd..d854fd5 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 5f1392a..fdb0f1e 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 bf7088f00c40add839d05b61d8f0fb7a04602b51 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:11:24 +0000 Subject: [PATCH 18/18] release: 2.0.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 19 +++++++++++++++++++ README.md | 2 +- src/Version.php | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2a8f4ff..65f558e 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/CHANGELOG.md b/CHANGELOG.md index 9e0ab2d..8122751 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 2.0.0 (2026-07-06) + +Full Changelog: [v1.3.0...v2.0.0](https://github.com/context-dot-dev/context-php-sdk/compare/v1.3.0...v2.0.0) + +### Features + +* **api:** api update ([a109b94](https://github.com/context-dot-dev/context-php-sdk/commit/a109b94c372f554a6f9d6c669dd01fc3afe37c85)) +* **api:** api update ([fc46359](https://github.com/context-dot-dev/context-php-sdk/commit/fc4635910c2035f4edffb817e4a7259b82e1c39c)) +* **api:** api update ([b6570c0](https://github.com/context-dot-dev/context-php-sdk/commit/b6570c0cad69d665d2cce99f57c2b85fb6ff408e)) +* **api:** api update ([61d8ed4](https://github.com/context-dot-dev/context-php-sdk/commit/61d8ed4cb6be1d1c2caad265f97987b5e93f620d)) +* **api:** api update ([16b3c1e](https://github.com/context-dot-dev/context-php-sdk/commit/16b3c1efb31c9d1da12ab3a2a5e65f4bfcd74247)) +* **api:** api update ([b96c262](https://github.com/context-dot-dev/context-php-sdk/commit/b96c26218eb833e9227dee9551ee9eb2b94b9abd)) +* **api:** api update ([4589097](https://github.com/context-dot-dev/context-php-sdk/commit/45890973be2637f7e69fb82cc5b5e52840420ca1)) +* **api:** api update ([b635a05](https://github.com/context-dot-dev/context-php-sdk/commit/b635a0588edc056550fbf1ddce2a239f4b4b29b2)) +* **api:** api update ([f7a3ee5](https://github.com/context-dot-dev/context-php-sdk/commit/f7a3ee5f797c5bd286293a69db0b50cd402d56fe)) +* **api:** manual updates ([33c37e5](https://github.com/context-dot-dev/context-php-sdk/commit/33c37e56e87ef187161361879db3cc25c12e663e)) +* **api:** manual updates ([d3c55dc](https://github.com/context-dot-dev/context-php-sdk/commit/d3c55dc909d9431595788c4e140a608e7cea5c5d)) +* **api:** manual updates ([d1b85dd](https://github.com/context-dot-dev/context-php-sdk/commit/d1b85ddef694ea143f27b352a9bca54f77b07512)) + ## 1.3.0 (2026-06-27) Full Changelog: [v1.2.0...v1.3.0](https://github.com/context-dot-dev/context-php-sdk/compare/v1.2.0...v1.3.0) diff --git a/README.md b/README.md index bb8741f..817bc6b 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/Version.php b/src/Version.php index 348143f..7f441e3 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