@ichos/sdk 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/BaseClient.d.ts +43 -0
- package/dist/BaseClient.js +29 -0
- package/dist/Client.d.ts +38 -0
- package/dist/Client.js +53 -0
- package/dist/api/errors/ForbiddenError.d.ts +6 -0
- package/dist/api/errors/ForbiddenError.js +17 -0
- package/dist/api/errors/InternalServerError.d.ts +6 -0
- package/dist/api/errors/InternalServerError.js +17 -0
- package/dist/api/errors/NotFoundError.d.ts +6 -0
- package/dist/api/errors/NotFoundError.js +17 -0
- package/dist/api/errors/UnauthorizedError.d.ts +6 -0
- package/dist/api/errors/UnauthorizedError.js +17 -0
- package/dist/api/errors/UnprocessableEntityError.d.ts +6 -0
- package/dist/api/errors/UnprocessableEntityError.js +17 -0
- package/dist/api/errors/index.d.ts +5 -0
- package/dist/api/errors/index.js +5 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +3 -0
- package/dist/api/resources/ads/client/Client.d.ts +226 -0
- package/dist/api/resources/ads/client/Client.js +732 -0
- package/dist/api/resources/ads/client/index.d.ts +1 -0
- package/dist/api/resources/ads/client/index.js +1 -0
- package/dist/api/resources/ads/client/requests/AdCreate.d.ts +24 -0
- package/dist/api/resources/ads/client/requests/AdCreate.js +8 -0
- package/dist/api/resources/ads/client/requests/AdInsertionPointCreate.d.ts +11 -0
- package/dist/api/resources/ads/client/requests/AdInsertionPointCreate.js +2 -0
- package/dist/api/resources/ads/client/requests/AdUpdate.d.ts +23 -0
- package/dist/api/resources/ads/client/requests/AdUpdate.js +8 -0
- package/dist/api/resources/ads/client/requests/DeleteAdRequest.d.ts +12 -0
- package/dist/api/resources/ads/client/requests/DeleteAdRequest.js +2 -0
- package/dist/api/resources/ads/client/requests/LinkAdAudioRequest.d.ts +13 -0
- package/dist/api/resources/ads/client/requests/LinkAdAudioRequest.js +2 -0
- package/dist/api/resources/ads/client/requests/ListAdInsertionPointsRequest.d.ts +10 -0
- package/dist/api/resources/ads/client/requests/ListAdInsertionPointsRequest.js +2 -0
- package/dist/api/resources/ads/client/requests/ListVirtualUserAdsRequest.d.ts +8 -0
- package/dist/api/resources/ads/client/requests/ListVirtualUserAdsRequest.js +2 -0
- package/dist/api/resources/ads/client/requests/UpdateAdWeightRequest.d.ts +9 -0
- package/dist/api/resources/ads/client/requests/UpdateAdWeightRequest.js +2 -0
- package/dist/api/resources/ads/client/requests/index.d.ts +8 -0
- package/dist/api/resources/ads/client/requests/index.js +1 -0
- package/dist/api/resources/ads/index.d.ts +1 -0
- package/dist/api/resources/ads/index.js +1 -0
- package/dist/api/resources/analytics/client/Client.d.ts +28 -0
- package/dist/api/resources/analytics/client/Client.js +68 -0
- package/dist/api/resources/analytics/client/index.d.ts +1 -0
- package/dist/api/resources/analytics/client/index.js +1 -0
- package/dist/api/resources/analytics/client/requests/GetAverageMonthlyListenersRequest.d.ts +9 -0
- package/dist/api/resources/analytics/client/requests/GetAverageMonthlyListenersRequest.js +2 -0
- package/dist/api/resources/analytics/client/requests/index.d.ts +1 -0
- package/dist/api/resources/analytics/client/requests/index.js +1 -0
- package/dist/api/resources/analytics/index.d.ts +1 -0
- package/dist/api/resources/analytics/index.js +1 -0
- package/dist/api/resources/audio/client/Client.d.ts +130 -0
- package/dist/api/resources/audio/client/Client.js +402 -0
- package/dist/api/resources/audio/client/index.d.ts +1 -0
- package/dist/api/resources/audio/client/index.js +1 -0
- package/dist/api/resources/audio/client/requests/DeleteAudioRequest.d.ts +10 -0
- package/dist/api/resources/audio/client/requests/DeleteAudioRequest.js +2 -0
- package/dist/api/resources/audio/client/requests/FinalizeAudioUploadRequest.d.ts +16 -0
- package/dist/api/resources/audio/client/requests/FinalizeAudioUploadRequest.js +2 -0
- package/dist/api/resources/audio/client/requests/GetAudioPullStatusRequest.d.ts +10 -0
- package/dist/api/resources/audio/client/requests/GetAudioPullStatusRequest.js +2 -0
- package/dist/api/resources/audio/client/requests/GetAudioRequest.d.ts +10 -0
- package/dist/api/resources/audio/client/requests/GetAudioRequest.js +2 -0
- package/dist/api/resources/audio/client/requests/PullAudioDto.d.ts +9 -0
- package/dist/api/resources/audio/client/requests/PullAudioDto.js +2 -0
- package/dist/api/resources/audio/client/requests/TextToSpeechRequest.d.ts +10 -0
- package/dist/api/resources/audio/client/requests/TextToSpeechRequest.js +2 -0
- package/dist/api/resources/audio/client/requests/index.d.ts +6 -0
- package/dist/api/resources/audio/client/requests/index.js +1 -0
- package/dist/api/resources/audio/index.d.ts +1 -0
- package/dist/api/resources/audio/index.js +1 -0
- package/dist/api/resources/episodes/client/Client.d.ts +234 -0
- package/dist/api/resources/episodes/client/Client.js +746 -0
- package/dist/api/resources/episodes/client/index.d.ts +1 -0
- package/dist/api/resources/episodes/client/index.js +1 -0
- package/dist/api/resources/episodes/client/requests/DeleteEpisodeRequest.d.ts +12 -0
- package/dist/api/resources/episodes/client/requests/DeleteEpisodeRequest.js +2 -0
- package/dist/api/resources/episodes/client/requests/EpisodeCreate.d.ts +45 -0
- package/dist/api/resources/episodes/client/requests/EpisodeCreate.js +15 -0
- package/dist/api/resources/episodes/client/requests/EpisodeUpdate.d.ts +45 -0
- package/dist/api/resources/episodes/client/requests/EpisodeUpdate.js +15 -0
- package/dist/api/resources/episodes/client/requests/GenerateEpisodeCoverUploadUrlRequest.d.ts +10 -0
- package/dist/api/resources/episodes/client/requests/GenerateEpisodeCoverUploadUrlRequest.js +2 -0
- package/dist/api/resources/episodes/client/requests/GetEpisodeAudioRequest.d.ts +10 -0
- package/dist/api/resources/episodes/client/requests/GetEpisodeAudioRequest.js +2 -0
- package/dist/api/resources/episodes/client/requests/GetEpisodeCoverRequest.d.ts +10 -0
- package/dist/api/resources/episodes/client/requests/GetEpisodeCoverRequest.js +2 -0
- package/dist/api/resources/episodes/client/requests/GetEpisodeListenersReportRequest.d.ts +10 -0
- package/dist/api/resources/episodes/client/requests/GetEpisodeListenersReportRequest.js +2 -0
- package/dist/api/resources/episodes/client/requests/GetEpisodeRequest.d.ts +10 -0
- package/dist/api/resources/episodes/client/requests/GetEpisodeRequest.js +2 -0
- package/dist/api/resources/episodes/client/requests/LinkEpisodeAudioRequest.d.ts +13 -0
- package/dist/api/resources/episodes/client/requests/LinkEpisodeAudioRequest.js +2 -0
- package/dist/api/resources/episodes/client/requests/ListPodcastEpisodesRequest.d.ts +10 -0
- package/dist/api/resources/episodes/client/requests/ListPodcastEpisodesRequest.js +2 -0
- package/dist/api/resources/episodes/client/requests/PublishEpisodeRequest.d.ts +10 -0
- package/dist/api/resources/episodes/client/requests/PublishEpisodeRequest.js +2 -0
- package/dist/api/resources/episodes/client/requests/PullEpisodeCoverFromUrlRequest.d.ts +12 -0
- package/dist/api/resources/episodes/client/requests/PullEpisodeCoverFromUrlRequest.js +2 -0
- package/dist/api/resources/episodes/client/requests/index.d.ts +12 -0
- package/dist/api/resources/episodes/client/requests/index.js +1 -0
- package/dist/api/resources/episodes/index.d.ts +1 -0
- package/dist/api/resources/episodes/index.js +1 -0
- package/dist/api/resources/index.d.ts +17 -0
- package/dist/api/resources/index.js +17 -0
- package/dist/api/resources/organizations/client/Client.d.ts +40 -0
- package/dist/api/resources/organizations/client/Client.js +122 -0
- package/dist/api/resources/organizations/client/index.d.ts +1 -0
- package/dist/api/resources/organizations/client/index.js +1 -0
- package/dist/api/resources/organizations/index.d.ts +1 -0
- package/dist/api/resources/organizations/index.js +1 -0
- package/dist/api/resources/podcasts/client/Client.d.ts +246 -0
- package/dist/api/resources/podcasts/client/Client.js +787 -0
- package/dist/api/resources/podcasts/client/index.d.ts +1 -0
- package/dist/api/resources/podcasts/client/index.js +1 -0
- package/dist/api/resources/podcasts/client/requests/DeletePodcastRequest.d.ts +10 -0
- package/dist/api/resources/podcasts/client/requests/DeletePodcastRequest.js +2 -0
- package/dist/api/resources/podcasts/client/requests/GeneratePodcastCoverUploadUrlRequest.d.ts +10 -0
- package/dist/api/resources/podcasts/client/requests/GeneratePodcastCoverUploadUrlRequest.js +2 -0
- package/dist/api/resources/podcasts/client/requests/GetPodcastCoverRequest.d.ts +10 -0
- package/dist/api/resources/podcasts/client/requests/GetPodcastCoverRequest.js +2 -0
- package/dist/api/resources/podcasts/client/requests/GetPodcastListenersReportRequest.d.ts +10 -0
- package/dist/api/resources/podcasts/client/requests/GetPodcastListenersReportRequest.js +2 -0
- package/dist/api/resources/podcasts/client/requests/GetPodcastRequest.d.ts +10 -0
- package/dist/api/resources/podcasts/client/requests/GetPodcastRequest.js +2 -0
- package/dist/api/resources/podcasts/client/requests/GetPodcastRssRequest.d.ts +10 -0
- package/dist/api/resources/podcasts/client/requests/GetPodcastRssRequest.js +2 -0
- package/dist/api/resources/podcasts/client/requests/ImportPodcastFromRssRequest.d.ts +10 -0
- package/dist/api/resources/podcasts/client/requests/ImportPodcastFromRssRequest.js +2 -0
- package/dist/api/resources/podcasts/client/requests/PodcastCreate.d.ts +59 -0
- package/dist/api/resources/podcasts/client/requests/PodcastCreate.js +9 -0
- package/dist/api/resources/podcasts/client/requests/PodcastUpdate.d.ts +60 -0
- package/dist/api/resources/podcasts/client/requests/PodcastUpdate.js +9 -0
- package/dist/api/resources/podcasts/client/requests/PublishPodcastRequest.d.ts +10 -0
- package/dist/api/resources/podcasts/client/requests/PublishPodcastRequest.js +2 -0
- package/dist/api/resources/podcasts/client/requests/PullPodcastCoverFromUrlRequest.d.ts +12 -0
- package/dist/api/resources/podcasts/client/requests/PullPodcastCoverFromUrlRequest.js +2 -0
- package/dist/api/resources/podcasts/client/requests/ValidatePodcastRequest.d.ts +10 -0
- package/dist/api/resources/podcasts/client/requests/ValidatePodcastRequest.js +2 -0
- package/dist/api/resources/podcasts/client/requests/index.d.ts +12 -0
- package/dist/api/resources/podcasts/client/requests/index.js +1 -0
- package/dist/api/resources/podcasts/index.d.ts +1 -0
- package/dist/api/resources/podcasts/index.js +1 -0
- package/dist/api/resources/segments/client/Client.d.ts +120 -0
- package/dist/api/resources/segments/client/Client.js +374 -0
- package/dist/api/resources/segments/client/index.d.ts +1 -0
- package/dist/api/resources/segments/client/index.js +1 -0
- package/dist/api/resources/segments/client/requests/DeleteSegmentRequest.d.ts +12 -0
- package/dist/api/resources/segments/client/requests/DeleteSegmentRequest.js +2 -0
- package/dist/api/resources/segments/client/requests/LinkSegmentAudioRequest.d.ts +13 -0
- package/dist/api/resources/segments/client/requests/LinkSegmentAudioRequest.js +2 -0
- package/dist/api/resources/segments/client/requests/ListPodcastSegmentsRequest.d.ts +10 -0
- package/dist/api/resources/segments/client/requests/ListPodcastSegmentsRequest.js +2 -0
- package/dist/api/resources/segments/client/requests/SegmentCreate.d.ts +29 -0
- package/dist/api/resources/segments/client/requests/SegmentCreate.js +13 -0
- package/dist/api/resources/segments/client/requests/SegmentUpdate.d.ts +29 -0
- package/dist/api/resources/segments/client/requests/SegmentUpdate.js +13 -0
- package/dist/api/resources/segments/client/requests/index.d.ts +5 -0
- package/dist/api/resources/segments/client/requests/index.js +1 -0
- package/dist/api/resources/segments/index.d.ts +1 -0
- package/dist/api/resources/segments/index.js +1 -0
- package/dist/api/resources/users/client/Client.d.ts +89 -0
- package/dist/api/resources/users/client/Client.js +293 -0
- package/dist/api/resources/users/client/index.d.ts +1 -0
- package/dist/api/resources/users/client/index.js +1 -0
- package/dist/api/resources/users/client/requests/UpdateCurrentVirtualUserRequest.d.ts +7 -0
- package/dist/api/resources/users/client/requests/UpdateCurrentVirtualUserRequest.js +2 -0
- package/dist/api/resources/users/client/requests/index.d.ts +1 -0
- package/dist/api/resources/users/client/requests/index.js +1 -0
- package/dist/api/resources/users/index.d.ts +1 -0
- package/dist/api/resources/users/index.js +1 -0
- package/dist/api/resources/webhooks/client/Client.d.ts +76 -0
- package/dist/api/resources/webhooks/client/Client.js +236 -0
- package/dist/api/resources/webhooks/client/index.d.ts +1 -0
- package/dist/api/resources/webhooks/client/index.js +1 -0
- package/dist/api/resources/webhooks/client/requests/CreateWebhookDestinationRequest.d.ts +10 -0
- package/dist/api/resources/webhooks/client/requests/CreateWebhookDestinationRequest.js +2 -0
- package/dist/api/resources/webhooks/client/requests/DeleteWebhookDestinationRequest.d.ts +10 -0
- package/dist/api/resources/webhooks/client/requests/DeleteWebhookDestinationRequest.js +2 -0
- package/dist/api/resources/webhooks/client/requests/index.d.ts +2 -0
- package/dist/api/resources/webhooks/client/requests/index.js +1 -0
- package/dist/api/resources/webhooks/index.d.ts +1 -0
- package/dist/api/resources/webhooks/index.js +1 -0
- package/dist/api/types/Ad.d.ts +16 -0
- package/dist/api/types/Ad.js +8 -0
- package/dist/api/types/AdId.d.ts +9 -0
- package/dist/api/types/AdId.js +7 -0
- package/dist/api/types/AdInsertionPoint.d.ts +5 -0
- package/dist/api/types/AdInsertionPoint.js +2 -0
- package/dist/api/types/AdInsertionPointListResponse.d.ts +6 -0
- package/dist/api/types/AdInsertionPointListResponse.js +2 -0
- package/dist/api/types/AdInsertionPointResponse.d.ts +6 -0
- package/dist/api/types/AdInsertionPointResponse.js +2 -0
- package/dist/api/types/AdListResponse.d.ts +6 -0
- package/dist/api/types/AdListResponse.js +2 -0
- package/dist/api/types/AdResponse.d.ts +6 -0
- package/dist/api/types/AdResponse.js +2 -0
- package/dist/api/types/AdWeight.d.ts +5 -0
- package/dist/api/types/AdWeight.js +2 -0
- package/dist/api/types/AdWeightListResponse.d.ts +6 -0
- package/dist/api/types/AdWeightListResponse.js +2 -0
- package/dist/api/types/ApiMeta.d.ts +3 -0
- package/dist/api/types/ApiMeta.js +2 -0
- package/dist/api/types/ApiMetaSuccess.d.ts +5 -0
- package/dist/api/types/ApiMetaSuccess.js +2 -0
- package/dist/api/types/ApplePodcastCategory.d.ts +113 -0
- package/dist/api/types/ApplePodcastCategory.js +113 -0
- package/dist/api/types/Audio.d.ts +27 -0
- package/dist/api/types/Audio.js +12 -0
- package/dist/api/types/AudioEntityLink.d.ts +16 -0
- package/dist/api/types/AudioEntityLink.js +2 -0
- package/dist/api/types/AudioProcessedPayload.d.ts +3 -0
- package/dist/api/types/AudioProcessedPayload.js +2 -0
- package/dist/api/types/AudioPullResponse.d.ts +12 -0
- package/dist/api/types/AudioPullResponse.js +2 -0
- package/dist/api/types/AudioPullStatusResponse.d.ts +22 -0
- package/dist/api/types/AudioPullStatusResponse.js +15 -0
- package/dist/api/types/AudioPulledPayload.d.ts +3 -0
- package/dist/api/types/AudioPulledPayload.js +2 -0
- package/dist/api/types/AudioResponse.d.ts +6 -0
- package/dist/api/types/AudioResponse.js +2 -0
- package/dist/api/types/AudioUploadOptions.d.ts +11 -0
- package/dist/api/types/AudioUploadOptions.js +2 -0
- package/dist/api/types/AudioUploadResponse.d.ts +24 -0
- package/dist/api/types/AudioUploadResponse.js +10 -0
- package/dist/api/types/AuthenticatedOrganizationResponse.d.ts +6 -0
- package/dist/api/types/AuthenticatedOrganizationResponse.js +2 -0
- package/dist/api/types/Chapter.d.ts +5 -0
- package/dist/api/types/Chapter.js +2 -0
- package/dist/api/types/CoverUploadOptions.d.ts +11 -0
- package/dist/api/types/CoverUploadOptions.js +2 -0
- package/dist/api/types/CoverUploadResponse.d.ts +23 -0
- package/dist/api/types/CoverUploadResponse.js +10 -0
- package/dist/api/types/Episode.d.ts +42 -0
- package/dist/api/types/Episode.js +15 -0
- package/dist/api/types/EpisodeCreateResponse.d.ts +6 -0
- package/dist/api/types/EpisodeCreateResponse.js +2 -0
- package/dist/api/types/EpisodeCreatedResponseData.d.ts +44 -0
- package/dist/api/types/EpisodeCreatedResponseData.js +15 -0
- package/dist/api/types/EpisodeId.d.ts +9 -0
- package/dist/api/types/EpisodeId.js +7 -0
- package/dist/api/types/EpisodeResponse.d.ts +6 -0
- package/dist/api/types/EpisodeResponse.js +2 -0
- package/dist/api/types/EpisodeTranscript.d.ts +6 -0
- package/dist/api/types/EpisodeTranscript.js +2 -0
- package/dist/api/types/EpisodesResponse.d.ts +6 -0
- package/dist/api/types/EpisodesResponse.js +2 -0
- package/dist/api/types/InternalServerErrorBody.d.ts +8 -0
- package/dist/api/types/InternalServerErrorBody.js +2 -0
- package/dist/api/types/InternalServerErrorResponse.d.ts +6 -0
- package/dist/api/types/InternalServerErrorResponse.js +2 -0
- package/dist/api/types/ListWebhookDestinationsResponse.d.ts +6 -0
- package/dist/api/types/ListWebhookDestinationsResponse.js +2 -0
- package/dist/api/types/ListWebhookEventsResponse.d.ts +6 -0
- package/dist/api/types/ListWebhookEventsResponse.js +2 -0
- package/dist/api/types/Listeners.d.ts +4 -0
- package/dist/api/types/Listeners.js +2 -0
- package/dist/api/types/ListenersReport.d.ts +5 -0
- package/dist/api/types/ListenersReport.js +2 -0
- package/dist/api/types/ListenersReportResponse.d.ts +6 -0
- package/dist/api/types/ListenersReportResponse.js +2 -0
- package/dist/api/types/MonthlyListenersResponse.d.ts +6 -0
- package/dist/api/types/MonthlyListenersResponse.js +2 -0
- package/dist/api/types/NotFoundErrorBody.d.ts +8 -0
- package/dist/api/types/NotFoundErrorBody.js +2 -0
- package/dist/api/types/NotFoundErrorResponse.d.ts +6 -0
- package/dist/api/types/NotFoundErrorResponse.js +2 -0
- package/dist/api/types/NullResponse.d.ts +6 -0
- package/dist/api/types/NullResponse.js +2 -0
- package/dist/api/types/Organization.d.ts +19 -0
- package/dist/api/types/Organization.js +12 -0
- package/dist/api/types/Person.d.ts +7 -0
- package/dist/api/types/Person.js +2 -0
- package/dist/api/types/Podcast.d.ts +65 -0
- package/dist/api/types/Podcast.js +15 -0
- package/dist/api/types/PodcastImportCompletedPayload.d.ts +3 -0
- package/dist/api/types/PodcastImportCompletedPayload.js +2 -0
- package/dist/api/types/PodcastImportFailedPayload.d.ts +5 -0
- package/dist/api/types/PodcastImportFailedPayload.js +2 -0
- package/dist/api/types/PodcastResponse.d.ts +6 -0
- package/dist/api/types/PodcastResponse.js +2 -0
- package/dist/api/types/PodcastsResponse.d.ts +6 -0
- package/dist/api/types/PodcastsResponse.js +2 -0
- package/dist/api/types/PublishPodcastOutput.d.ts +3 -0
- package/dist/api/types/PublishPodcastOutput.js +2 -0
- package/dist/api/types/RetrieveCoverResponse.d.ts +11 -0
- package/dist/api/types/RetrieveCoverResponse.js +2 -0
- package/dist/api/types/Segment.d.ts +25 -0
- package/dist/api/types/Segment.js +13 -0
- package/dist/api/types/SegmentId.d.ts +9 -0
- package/dist/api/types/SegmentId.js +7 -0
- package/dist/api/types/SegmentListResponse.d.ts +6 -0
- package/dist/api/types/SegmentListResponse.js +2 -0
- package/dist/api/types/SegmentResponse.d.ts +6 -0
- package/dist/api/types/SegmentResponse.js +2 -0
- package/dist/api/types/StringOrNullResponse.d.ts +6 -0
- package/dist/api/types/StringOrNullResponse.js +2 -0
- package/dist/api/types/StringResponse.d.ts +6 -0
- package/dist/api/types/StringResponse.js +2 -0
- package/dist/api/types/TranscriptCompletedPayload.d.ts +4 -0
- package/dist/api/types/TranscriptCompletedPayload.js +2 -0
- package/dist/api/types/UnauthenticatedError.d.ts +8 -0
- package/dist/api/types/UnauthenticatedError.js +2 -0
- package/dist/api/types/UnauthenticatedErrorResponse.d.ts +6 -0
- package/dist/api/types/UnauthenticatedErrorResponse.js +2 -0
- package/dist/api/types/UnauthorizedErrorBody.d.ts +8 -0
- package/dist/api/types/UnauthorizedErrorBody.js +2 -0
- package/dist/api/types/UnauthorizedErrorResponse.d.ts +6 -0
- package/dist/api/types/UnauthorizedErrorResponse.js +2 -0
- package/dist/api/types/UserUploadAudioResponse.d.ts +6 -0
- package/dist/api/types/UserUploadAudioResponse.js +2 -0
- package/dist/api/types/UserUploadAudioResult.d.ts +5 -0
- package/dist/api/types/UserUploadAudioResult.js +2 -0
- package/dist/api/types/UserUploadCoverResponse.d.ts +6 -0
- package/dist/api/types/UserUploadCoverResponse.js +2 -0
- package/dist/api/types/UserUploadCoverResult.d.ts +5 -0
- package/dist/api/types/UserUploadCoverResult.js +2 -0
- package/dist/api/types/UserUploadCoverResultResponse.d.ts +6 -0
- package/dist/api/types/UserUploadCoverResultResponse.js +2 -0
- package/dist/api/types/ValidationErrorResponse.d.ts +6 -0
- package/dist/api/types/ValidationErrorResponse.js +2 -0
- package/dist/api/types/ValidationIssue.d.ts +17 -0
- package/dist/api/types/ValidationIssue.js +11 -0
- package/dist/api/types/VirtualUser.d.ts +10 -0
- package/dist/api/types/VirtualUser.js +2 -0
- package/dist/api/types/VirtualUserListResponse.d.ts +6 -0
- package/dist/api/types/VirtualUserListResponse.js +2 -0
- package/dist/api/types/VirtualUserResponse.d.ts +6 -0
- package/dist/api/types/VirtualUserResponse.js +2 -0
- package/dist/api/types/WebhookDestination.d.ts +7 -0
- package/dist/api/types/WebhookDestination.js +2 -0
- package/dist/api/types/WebhookDestinationResponse.d.ts +6 -0
- package/dist/api/types/WebhookDestinationResponse.js +2 -0
- package/dist/api/types/WebhookEvent.d.ts +28 -0
- package/dist/api/types/WebhookEvent.js +16 -0
- package/dist/api/types/index.d.ts +76 -0
- package/dist/api/types/index.js +76 -0
- package/dist/auth/BearerAuthProvider.d.ts +16 -0
- package/dist/auth/BearerAuthProvider.js +23 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +1 -0
- package/dist/core/auth/AuthProvider.d.ts +7 -0
- package/dist/core/auth/AuthProvider.js +1 -0
- package/dist/core/auth/AuthRequest.d.ts +9 -0
- package/dist/core/auth/AuthRequest.js +1 -0
- package/dist/core/auth/BasicAuth.d.ts +8 -0
- package/dist/core/auth/BasicAuth.js +24 -0
- package/dist/core/auth/BearerToken.d.ts +7 -0
- package/dist/core/auth/BearerToken.js +13 -0
- package/dist/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/core/auth/NoOpAuthProvider.js +5 -0
- package/dist/core/auth/index.d.ts +5 -0
- package/dist/core/auth/index.js +3 -0
- package/dist/core/base64.d.ts +2 -0
- package/dist/core/base64.js +22 -0
- package/dist/core/exports.d.ts +1 -0
- package/dist/core/exports.js +1 -0
- package/dist/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/core/fetcher/APIResponse.js +1 -0
- package/dist/core/fetcher/BinaryResponse.d.ts +19 -0
- package/dist/core/fetcher/BinaryResponse.js +14 -0
- package/dist/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/core/fetcher/EndpointMetadata.js +1 -0
- package/dist/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/core/fetcher/EndpointSupplier.js +10 -0
- package/dist/core/fetcher/Fetcher.d.ts +49 -0
- package/dist/core/fetcher/Fetcher.js +295 -0
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +83 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +90 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +40 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +10 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +5 -0
- package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getErrorResponseBody.js +30 -0
- package/dist/core/fetcher/getFetchFn.d.ts +1 -0
- package/dist/core/fetcher/getFetchFn.js +3 -0
- package/dist/core/fetcher/getHeader.d.ts +1 -0
- package/dist/core/fetcher/getHeader.js +8 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +13 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +55 -0
- package/dist/core/fetcher/index.d.ts +11 -0
- package/dist/core/fetcher/index.js +6 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +27 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +53 -0
- package/dist/core/fetcher/signals.d.ts +5 -0
- package/dist/core/fetcher/signals.js +20 -0
- package/dist/core/headers.d.ts +2 -0
- package/dist/core/headers.js +27 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +6 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +19 -0
- package/dist/core/logging/exports.d.ts +18 -0
- package/dist/core/logging/exports.js +9 -0
- package/dist/core/logging/index.d.ts +1 -0
- package/dist/core/logging/index.js +1 -0
- package/dist/core/logging/logger.d.ts +126 -0
- package/dist/core/logging/logger.js +140 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +1 -0
- package/dist/core/runtime/runtime.d.ts +9 -0
- package/dist/core/runtime/runtime.js +99 -0
- package/dist/core/url/encodePathParam.d.ts +1 -0
- package/dist/core/url/encodePathParam.js +18 -0
- package/dist/core/url/index.d.ts +3 -0
- package/dist/core/url/index.js +3 -0
- package/dist/core/url/join.d.ts +1 -0
- package/dist/core/url/join.js +65 -0
- package/dist/core/url/qs.d.ts +6 -0
- package/dist/core/url/qs.js +64 -0
- package/dist/environments.d.ts +4 -0
- package/dist/environments.js +4 -0
- package/dist/errors/IchosError.d.ts +12 -0
- package/dist/errors/IchosError.js +31 -0
- package/dist/errors/IchosTimeoutError.d.ts +3 -0
- package/dist/errors/IchosTimeoutError.js +11 -0
- package/dist/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/errors/handleNonStatusCodeError.js +29 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +2 -0
- package/dist/exports.d.ts +1 -0
- package/dist/exports.js +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/package.json +23 -0
|
@@ -0,0 +1,732 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js";
|
|
4
|
+
import * as core from "../../../../core/index.js";
|
|
5
|
+
import * as environments from "../../../../environments.js";
|
|
6
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js";
|
|
7
|
+
import * as errors from "../../../../errors/index.js";
|
|
8
|
+
import * as Ichos from "../../../index.js";
|
|
9
|
+
export class AdsClient {
|
|
10
|
+
_options;
|
|
11
|
+
constructor(options) {
|
|
12
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a new ad. Ads are associated with either an organization or a virtual user.
|
|
16
|
+
* An organization ad must have an organizationId and no virtualUserId.
|
|
17
|
+
* A virtual user ad must have both an organizationId and a virtualUserId.
|
|
18
|
+
* Audio for the ad will need to be uploaded separately and linked via the /link-audio endpoint.
|
|
19
|
+
*
|
|
20
|
+
* @param {Ichos.AdCreate} request
|
|
21
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
22
|
+
*
|
|
23
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
24
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
25
|
+
* @throws {@link Ichos.InternalServerError}
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* await client.ads.createAd({
|
|
29
|
+
* active: true,
|
|
30
|
+
* label: "label",
|
|
31
|
+
* type: "organization",
|
|
32
|
+
* organizationId: "organizationId"
|
|
33
|
+
* })
|
|
34
|
+
*/
|
|
35
|
+
createAd(request, requestOptions) {
|
|
36
|
+
return core.HttpResponsePromise.fromPromise(this.__createAd(request, requestOptions));
|
|
37
|
+
}
|
|
38
|
+
async __createAd(request, requestOptions) {
|
|
39
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
40
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
41
|
+
const _response = await core.fetcher({
|
|
42
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
43
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
44
|
+
environments.IchosEnvironment.Default, "v1/ads"),
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: _headers,
|
|
47
|
+
contentType: "application/json",
|
|
48
|
+
queryParameters: requestOptions?.queryParams,
|
|
49
|
+
requestType: "json",
|
|
50
|
+
body: request,
|
|
51
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
52
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
53
|
+
abortSignal: requestOptions?.abortSignal,
|
|
54
|
+
fetchFn: this._options?.fetch,
|
|
55
|
+
logging: this._options.logging,
|
|
56
|
+
});
|
|
57
|
+
if (_response.ok) {
|
|
58
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
59
|
+
}
|
|
60
|
+
if (_response.error.reason === "status-code") {
|
|
61
|
+
switch (_response.error.statusCode) {
|
|
62
|
+
case 401:
|
|
63
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
64
|
+
case 403:
|
|
65
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
66
|
+
case 500:
|
|
67
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
68
|
+
default:
|
|
69
|
+
throw new errors.IchosError({
|
|
70
|
+
statusCode: _response.error.statusCode,
|
|
71
|
+
body: _response.error.body,
|
|
72
|
+
rawResponse: _response.rawResponse,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/ads");
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Delete an ad.
|
|
80
|
+
* Optionally delete the associated audio file.
|
|
81
|
+
*
|
|
82
|
+
* @param {Ichos.DeleteAdRequest} request
|
|
83
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
84
|
+
*
|
|
85
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
86
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
87
|
+
* @throws {@link Ichos.NotFoundError}
|
|
88
|
+
* @throws {@link Ichos.InternalServerError}
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* await client.ads.deleteAd({
|
|
92
|
+
* adId: "adId"
|
|
93
|
+
* })
|
|
94
|
+
*/
|
|
95
|
+
deleteAd(request, requestOptions) {
|
|
96
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteAd(request, requestOptions));
|
|
97
|
+
}
|
|
98
|
+
async __deleteAd(request, requestOptions) {
|
|
99
|
+
const { adId, deleteAudio } = request;
|
|
100
|
+
const _queryParams = {};
|
|
101
|
+
if (deleteAudio != null) {
|
|
102
|
+
_queryParams.deleteAudio = deleteAudio.toString();
|
|
103
|
+
}
|
|
104
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
105
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
106
|
+
const _response = await core.fetcher({
|
|
107
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
108
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
109
|
+
environments.IchosEnvironment.Default, `v1/ads/${core.url.encodePathParam(adId)}`),
|
|
110
|
+
method: "DELETE",
|
|
111
|
+
headers: _headers,
|
|
112
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
113
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
114
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
115
|
+
abortSignal: requestOptions?.abortSignal,
|
|
116
|
+
fetchFn: this._options?.fetch,
|
|
117
|
+
logging: this._options.logging,
|
|
118
|
+
});
|
|
119
|
+
if (_response.ok) {
|
|
120
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
121
|
+
}
|
|
122
|
+
if (_response.error.reason === "status-code") {
|
|
123
|
+
switch (_response.error.statusCode) {
|
|
124
|
+
case 401:
|
|
125
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
126
|
+
case 403:
|
|
127
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
128
|
+
case 404:
|
|
129
|
+
throw new Ichos.NotFoundError(_response.error.body, _response.rawResponse);
|
|
130
|
+
case 500:
|
|
131
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
132
|
+
default:
|
|
133
|
+
throw new errors.IchosError({
|
|
134
|
+
statusCode: _response.error.statusCode,
|
|
135
|
+
body: _response.error.body,
|
|
136
|
+
rawResponse: _response.rawResponse,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/ads/{adId}");
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Update an existing ad
|
|
144
|
+
*
|
|
145
|
+
* @param {Ichos.AdUpdate} request
|
|
146
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
147
|
+
*
|
|
148
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
149
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
150
|
+
* @throws {@link Ichos.InternalServerError}
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* await client.ads.updateAd({
|
|
154
|
+
* adId: "adId"
|
|
155
|
+
* })
|
|
156
|
+
*/
|
|
157
|
+
updateAd(request, requestOptions) {
|
|
158
|
+
return core.HttpResponsePromise.fromPromise(this.__updateAd(request, requestOptions));
|
|
159
|
+
}
|
|
160
|
+
async __updateAd(request, requestOptions) {
|
|
161
|
+
const { adId, ..._body } = request;
|
|
162
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
163
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
164
|
+
const _response = await core.fetcher({
|
|
165
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
166
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
167
|
+
environments.IchosEnvironment.Default, `v1/ads/${core.url.encodePathParam(adId)}`),
|
|
168
|
+
method: "PATCH",
|
|
169
|
+
headers: _headers,
|
|
170
|
+
contentType: "application/json",
|
|
171
|
+
queryParameters: requestOptions?.queryParams,
|
|
172
|
+
requestType: "json",
|
|
173
|
+
body: _body,
|
|
174
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
175
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
176
|
+
abortSignal: requestOptions?.abortSignal,
|
|
177
|
+
fetchFn: this._options?.fetch,
|
|
178
|
+
logging: this._options.logging,
|
|
179
|
+
});
|
|
180
|
+
if (_response.ok) {
|
|
181
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
182
|
+
}
|
|
183
|
+
if (_response.error.reason === "status-code") {
|
|
184
|
+
switch (_response.error.statusCode) {
|
|
185
|
+
case 401:
|
|
186
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
187
|
+
case 403:
|
|
188
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
189
|
+
case 500:
|
|
190
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
191
|
+
default:
|
|
192
|
+
throw new errors.IchosError({
|
|
193
|
+
statusCode: _response.error.statusCode,
|
|
194
|
+
body: _response.error.body,
|
|
195
|
+
rawResponse: _response.rawResponse,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v1/ads/{adId}");
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Link an audio file to an ad.
|
|
203
|
+
* This associates an uploaded audio file with the ad definition.
|
|
204
|
+
*
|
|
205
|
+
* @param {Ichos.LinkAdAudioRequest} request
|
|
206
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
207
|
+
*
|
|
208
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
209
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
210
|
+
* @throws {@link Ichos.InternalServerError}
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* await client.ads.linkAdAudio({
|
|
214
|
+
* adId: "adId",
|
|
215
|
+
* audioId: "audioId"
|
|
216
|
+
* })
|
|
217
|
+
*/
|
|
218
|
+
linkAdAudio(request, requestOptions) {
|
|
219
|
+
return core.HttpResponsePromise.fromPromise(this.__linkAdAudio(request, requestOptions));
|
|
220
|
+
}
|
|
221
|
+
async __linkAdAudio(request, requestOptions) {
|
|
222
|
+
const { adId, ..._body } = request;
|
|
223
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
224
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
225
|
+
const _response = await core.fetcher({
|
|
226
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
227
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
228
|
+
environments.IchosEnvironment.Default, `v1/ads/${core.url.encodePathParam(adId)}/link-audio`),
|
|
229
|
+
method: "PUT",
|
|
230
|
+
headers: _headers,
|
|
231
|
+
contentType: "application/json",
|
|
232
|
+
queryParameters: requestOptions?.queryParams,
|
|
233
|
+
requestType: "json",
|
|
234
|
+
body: _body,
|
|
235
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
236
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
237
|
+
abortSignal: requestOptions?.abortSignal,
|
|
238
|
+
fetchFn: this._options?.fetch,
|
|
239
|
+
logging: this._options.logging,
|
|
240
|
+
});
|
|
241
|
+
if (_response.ok) {
|
|
242
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
243
|
+
}
|
|
244
|
+
if (_response.error.reason === "status-code") {
|
|
245
|
+
switch (_response.error.statusCode) {
|
|
246
|
+
case 401:
|
|
247
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
248
|
+
case 403:
|
|
249
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
250
|
+
case 500:
|
|
251
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
252
|
+
default:
|
|
253
|
+
throw new errors.IchosError({
|
|
254
|
+
statusCode: _response.error.statusCode,
|
|
255
|
+
body: _response.error.body,
|
|
256
|
+
rawResponse: _response.rawResponse,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/ads/{adId}/link-audio");
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Retrieve all ads for the authenticated organization
|
|
264
|
+
*
|
|
265
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
266
|
+
*
|
|
267
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
268
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
269
|
+
* @throws {@link Ichos.NotFoundError}
|
|
270
|
+
* @throws {@link Ichos.InternalServerError}
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* await client.ads.listOrganizationAds()
|
|
274
|
+
*/
|
|
275
|
+
listOrganizationAds(requestOptions) {
|
|
276
|
+
return core.HttpResponsePromise.fromPromise(this.__listOrganizationAds(requestOptions));
|
|
277
|
+
}
|
|
278
|
+
async __listOrganizationAds(requestOptions) {
|
|
279
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
280
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
281
|
+
const _response = await core.fetcher({
|
|
282
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
283
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
284
|
+
environments.IchosEnvironment.Default, "v1/ads/organization"),
|
|
285
|
+
method: "GET",
|
|
286
|
+
headers: _headers,
|
|
287
|
+
queryParameters: requestOptions?.queryParams,
|
|
288
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
289
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
290
|
+
abortSignal: requestOptions?.abortSignal,
|
|
291
|
+
fetchFn: this._options?.fetch,
|
|
292
|
+
logging: this._options.logging,
|
|
293
|
+
});
|
|
294
|
+
if (_response.ok) {
|
|
295
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
296
|
+
}
|
|
297
|
+
if (_response.error.reason === "status-code") {
|
|
298
|
+
switch (_response.error.statusCode) {
|
|
299
|
+
case 401:
|
|
300
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
301
|
+
case 403:
|
|
302
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
303
|
+
case 404:
|
|
304
|
+
throw new Ichos.NotFoundError(_response.error.body, _response.rawResponse);
|
|
305
|
+
case 500:
|
|
306
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
307
|
+
default:
|
|
308
|
+
throw new errors.IchosError({
|
|
309
|
+
statusCode: _response.error.statusCode,
|
|
310
|
+
body: _response.error.body,
|
|
311
|
+
rawResponse: _response.rawResponse,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ads/organization");
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Retrieve all ads for a specific virtual user
|
|
319
|
+
*
|
|
320
|
+
* @param {Ichos.ListVirtualUserAdsRequest} request
|
|
321
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
322
|
+
*
|
|
323
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
324
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
325
|
+
* @throws {@link Ichos.NotFoundError}
|
|
326
|
+
* @throws {@link Ichos.InternalServerError}
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* await client.ads.listVirtualUserAds()
|
|
330
|
+
*/
|
|
331
|
+
listVirtualUserAds(request = {}, requestOptions) {
|
|
332
|
+
return core.HttpResponsePromise.fromPromise(this.__listVirtualUserAds(request, requestOptions));
|
|
333
|
+
}
|
|
334
|
+
async __listVirtualUserAds(request = {}, requestOptions) {
|
|
335
|
+
const { virtualUserId } = request;
|
|
336
|
+
const _queryParams = {};
|
|
337
|
+
if (virtualUserId != null) {
|
|
338
|
+
_queryParams.virtualUserId = virtualUserId;
|
|
339
|
+
}
|
|
340
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
341
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
342
|
+
const _response = await core.fetcher({
|
|
343
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
344
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
345
|
+
environments.IchosEnvironment.Default, "v1/ads/user"),
|
|
346
|
+
method: "GET",
|
|
347
|
+
headers: _headers,
|
|
348
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
349
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
350
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
351
|
+
abortSignal: requestOptions?.abortSignal,
|
|
352
|
+
fetchFn: this._options?.fetch,
|
|
353
|
+
logging: this._options.logging,
|
|
354
|
+
});
|
|
355
|
+
if (_response.ok) {
|
|
356
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
357
|
+
}
|
|
358
|
+
if (_response.error.reason === "status-code") {
|
|
359
|
+
switch (_response.error.statusCode) {
|
|
360
|
+
case 401:
|
|
361
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
362
|
+
case 403:
|
|
363
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
364
|
+
case 404:
|
|
365
|
+
throw new Ichos.NotFoundError(_response.error.body, _response.rawResponse);
|
|
366
|
+
case 500:
|
|
367
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
368
|
+
default:
|
|
369
|
+
throw new errors.IchosError({
|
|
370
|
+
statusCode: _response.error.statusCode,
|
|
371
|
+
body: _response.error.body,
|
|
372
|
+
rawResponse: _response.rawResponse,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ads/user");
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Retrieve ad weights for the authenticated virtual user
|
|
380
|
+
*
|
|
381
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
382
|
+
*
|
|
383
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
384
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
385
|
+
* @throws {@link Ichos.NotFoundError}
|
|
386
|
+
* @throws {@link Ichos.InternalServerError}
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* await client.ads.listAdWeights()
|
|
390
|
+
*/
|
|
391
|
+
listAdWeights(requestOptions) {
|
|
392
|
+
return core.HttpResponsePromise.fromPromise(this.__listAdWeights(requestOptions));
|
|
393
|
+
}
|
|
394
|
+
async __listAdWeights(requestOptions) {
|
|
395
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
396
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
397
|
+
const _response = await core.fetcher({
|
|
398
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
399
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
400
|
+
environments.IchosEnvironment.Default, "v1/ads/weights"),
|
|
401
|
+
method: "GET",
|
|
402
|
+
headers: _headers,
|
|
403
|
+
queryParameters: requestOptions?.queryParams,
|
|
404
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
405
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
406
|
+
abortSignal: requestOptions?.abortSignal,
|
|
407
|
+
fetchFn: this._options?.fetch,
|
|
408
|
+
logging: this._options.logging,
|
|
409
|
+
});
|
|
410
|
+
if (_response.ok) {
|
|
411
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
412
|
+
}
|
|
413
|
+
if (_response.error.reason === "status-code") {
|
|
414
|
+
switch (_response.error.statusCode) {
|
|
415
|
+
case 401:
|
|
416
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
417
|
+
case 403:
|
|
418
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
419
|
+
case 404:
|
|
420
|
+
throw new Ichos.NotFoundError(_response.error.body, _response.rawResponse);
|
|
421
|
+
case 500:
|
|
422
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
423
|
+
default:
|
|
424
|
+
throw new errors.IchosError({
|
|
425
|
+
statusCode: _response.error.statusCode,
|
|
426
|
+
body: _response.error.body,
|
|
427
|
+
rawResponse: _response.rawResponse,
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ads/weights");
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Update the ad weight for a virtual user or organization
|
|
435
|
+
*
|
|
436
|
+
* @param {Ichos.UpdateAdWeightRequest} request
|
|
437
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
438
|
+
*
|
|
439
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
440
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
441
|
+
* @throws {@link Ichos.NotFoundError}
|
|
442
|
+
* @throws {@link Ichos.InternalServerError}
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* await client.ads.updateAdWeight({
|
|
446
|
+
* weight: 1.1
|
|
447
|
+
* })
|
|
448
|
+
*/
|
|
449
|
+
updateAdWeight(request, requestOptions) {
|
|
450
|
+
return core.HttpResponsePromise.fromPromise(this.__updateAdWeight(request, requestOptions));
|
|
451
|
+
}
|
|
452
|
+
async __updateAdWeight(request, requestOptions) {
|
|
453
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
454
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
455
|
+
const _response = await core.fetcher({
|
|
456
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
457
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
458
|
+
environments.IchosEnvironment.Default, "v1/ads/weights"),
|
|
459
|
+
method: "PATCH",
|
|
460
|
+
headers: _headers,
|
|
461
|
+
contentType: "application/json",
|
|
462
|
+
queryParameters: requestOptions?.queryParams,
|
|
463
|
+
requestType: "json",
|
|
464
|
+
body: request,
|
|
465
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
466
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
467
|
+
abortSignal: requestOptions?.abortSignal,
|
|
468
|
+
fetchFn: this._options?.fetch,
|
|
469
|
+
logging: this._options.logging,
|
|
470
|
+
});
|
|
471
|
+
if (_response.ok) {
|
|
472
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
473
|
+
}
|
|
474
|
+
if (_response.error.reason === "status-code") {
|
|
475
|
+
switch (_response.error.statusCode) {
|
|
476
|
+
case 401:
|
|
477
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
478
|
+
case 403:
|
|
479
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
480
|
+
case 404:
|
|
481
|
+
throw new Ichos.NotFoundError(_response.error.body, _response.rawResponse);
|
|
482
|
+
case 500:
|
|
483
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
484
|
+
default:
|
|
485
|
+
throw new errors.IchosError({
|
|
486
|
+
statusCode: _response.error.statusCode,
|
|
487
|
+
body: _response.error.body,
|
|
488
|
+
rawResponse: _response.rawResponse,
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v1/ads/weights");
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Retrieve all ad weights for the organization
|
|
496
|
+
*
|
|
497
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
498
|
+
*
|
|
499
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
500
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
501
|
+
* @throws {@link Ichos.NotFoundError}
|
|
502
|
+
* @throws {@link Ichos.InternalServerError}
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* await client.ads.listAllAdWeights()
|
|
506
|
+
*/
|
|
507
|
+
listAllAdWeights(requestOptions) {
|
|
508
|
+
return core.HttpResponsePromise.fromPromise(this.__listAllAdWeights(requestOptions));
|
|
509
|
+
}
|
|
510
|
+
async __listAllAdWeights(requestOptions) {
|
|
511
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
512
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
513
|
+
const _response = await core.fetcher({
|
|
514
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
515
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
516
|
+
environments.IchosEnvironment.Default, "v1/ads/weights/all"),
|
|
517
|
+
method: "GET",
|
|
518
|
+
headers: _headers,
|
|
519
|
+
queryParameters: requestOptions?.queryParams,
|
|
520
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
521
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
522
|
+
abortSignal: requestOptions?.abortSignal,
|
|
523
|
+
fetchFn: this._options?.fetch,
|
|
524
|
+
logging: this._options.logging,
|
|
525
|
+
});
|
|
526
|
+
if (_response.ok) {
|
|
527
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
528
|
+
}
|
|
529
|
+
if (_response.error.reason === "status-code") {
|
|
530
|
+
switch (_response.error.statusCode) {
|
|
531
|
+
case 401:
|
|
532
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
533
|
+
case 403:
|
|
534
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
535
|
+
case 404:
|
|
536
|
+
throw new Ichos.NotFoundError(_response.error.body, _response.rawResponse);
|
|
537
|
+
case 500:
|
|
538
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
539
|
+
default:
|
|
540
|
+
throw new errors.IchosError({
|
|
541
|
+
statusCode: _response.error.statusCode,
|
|
542
|
+
body: _response.error.body,
|
|
543
|
+
rawResponse: _response.rawResponse,
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ads/weights/all");
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Update multiple ad weights in bulk
|
|
551
|
+
*
|
|
552
|
+
* @param {Ichos.AdWeight[]} request
|
|
553
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
554
|
+
*
|
|
555
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
556
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
557
|
+
* @throws {@link Ichos.NotFoundError}
|
|
558
|
+
* @throws {@link Ichos.InternalServerError}
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* await client.ads.updateAdWeightBulk([{
|
|
562
|
+
* organizationId: "organizationId",
|
|
563
|
+
* weight: 1.1
|
|
564
|
+
* }])
|
|
565
|
+
*/
|
|
566
|
+
updateAdWeightBulk(request, requestOptions) {
|
|
567
|
+
return core.HttpResponsePromise.fromPromise(this.__updateAdWeightBulk(request, requestOptions));
|
|
568
|
+
}
|
|
569
|
+
async __updateAdWeightBulk(request, requestOptions) {
|
|
570
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
571
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
572
|
+
const _response = await core.fetcher({
|
|
573
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
574
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
575
|
+
environments.IchosEnvironment.Default, "v1/ads/weights/bulk"),
|
|
576
|
+
method: "PATCH",
|
|
577
|
+
headers: _headers,
|
|
578
|
+
contentType: "application/json",
|
|
579
|
+
queryParameters: requestOptions?.queryParams,
|
|
580
|
+
requestType: "json",
|
|
581
|
+
body: request,
|
|
582
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
583
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
584
|
+
abortSignal: requestOptions?.abortSignal,
|
|
585
|
+
fetchFn: this._options?.fetch,
|
|
586
|
+
logging: this._options.logging,
|
|
587
|
+
});
|
|
588
|
+
if (_response.ok) {
|
|
589
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
590
|
+
}
|
|
591
|
+
if (_response.error.reason === "status-code") {
|
|
592
|
+
switch (_response.error.statusCode) {
|
|
593
|
+
case 401:
|
|
594
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
595
|
+
case 403:
|
|
596
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
597
|
+
case 404:
|
|
598
|
+
throw new Ichos.NotFoundError(_response.error.body, _response.rawResponse);
|
|
599
|
+
case 500:
|
|
600
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
601
|
+
default:
|
|
602
|
+
throw new errors.IchosError({
|
|
603
|
+
statusCode: _response.error.statusCode,
|
|
604
|
+
body: _response.error.body,
|
|
605
|
+
rawResponse: _response.rawResponse,
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v1/ads/weights/bulk");
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Create a new ad insertion point for an episode
|
|
613
|
+
*
|
|
614
|
+
* @param {Ichos.AdInsertionPointCreate} request
|
|
615
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
616
|
+
*
|
|
617
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
618
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
619
|
+
* @throws {@link Ichos.NotFoundError}
|
|
620
|
+
* @throws {@link Ichos.InternalServerError}
|
|
621
|
+
*
|
|
622
|
+
* @example
|
|
623
|
+
* await client.ads.createAdInsertionPoint({
|
|
624
|
+
* episodeId: "episodeId",
|
|
625
|
+
* offsetSeconds: 1.1
|
|
626
|
+
* })
|
|
627
|
+
*/
|
|
628
|
+
createAdInsertionPoint(request, requestOptions) {
|
|
629
|
+
return core.HttpResponsePromise.fromPromise(this.__createAdInsertionPoint(request, requestOptions));
|
|
630
|
+
}
|
|
631
|
+
async __createAdInsertionPoint(request, requestOptions) {
|
|
632
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
633
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
634
|
+
const _response = await core.fetcher({
|
|
635
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
636
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
637
|
+
environments.IchosEnvironment.Default, "v1/ads/insertion-points"),
|
|
638
|
+
method: "POST",
|
|
639
|
+
headers: _headers,
|
|
640
|
+
contentType: "application/json",
|
|
641
|
+
queryParameters: requestOptions?.queryParams,
|
|
642
|
+
requestType: "json",
|
|
643
|
+
body: request,
|
|
644
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
645
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
646
|
+
abortSignal: requestOptions?.abortSignal,
|
|
647
|
+
fetchFn: this._options?.fetch,
|
|
648
|
+
logging: this._options.logging,
|
|
649
|
+
});
|
|
650
|
+
if (_response.ok) {
|
|
651
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
652
|
+
}
|
|
653
|
+
if (_response.error.reason === "status-code") {
|
|
654
|
+
switch (_response.error.statusCode) {
|
|
655
|
+
case 401:
|
|
656
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
657
|
+
case 403:
|
|
658
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
659
|
+
case 404:
|
|
660
|
+
throw new Ichos.NotFoundError(_response.error.body, _response.rawResponse);
|
|
661
|
+
case 500:
|
|
662
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
663
|
+
default:
|
|
664
|
+
throw new errors.IchosError({
|
|
665
|
+
statusCode: _response.error.statusCode,
|
|
666
|
+
body: _response.error.body,
|
|
667
|
+
rawResponse: _response.rawResponse,
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/ads/insertion-points");
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Retrieve all ad insertion points for a specific episode
|
|
675
|
+
*
|
|
676
|
+
* @param {Ichos.ListAdInsertionPointsRequest} request
|
|
677
|
+
* @param {AdsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
678
|
+
*
|
|
679
|
+
* @throws {@link Ichos.UnauthorizedError}
|
|
680
|
+
* @throws {@link Ichos.ForbiddenError}
|
|
681
|
+
* @throws {@link Ichos.NotFoundError}
|
|
682
|
+
* @throws {@link Ichos.InternalServerError}
|
|
683
|
+
*
|
|
684
|
+
* @example
|
|
685
|
+
* await client.ads.listAdInsertionPoints({
|
|
686
|
+
* episodeId: "episodeId"
|
|
687
|
+
* })
|
|
688
|
+
*/
|
|
689
|
+
listAdInsertionPoints(request, requestOptions) {
|
|
690
|
+
return core.HttpResponsePromise.fromPromise(this.__listAdInsertionPoints(request, requestOptions));
|
|
691
|
+
}
|
|
692
|
+
async __listAdInsertionPoints(request, requestOptions) {
|
|
693
|
+
const { episodeId } = request;
|
|
694
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
695
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, mergeOnlyDefinedHeaders({ "x-virtual-user": requestOptions?.virtualUser ?? this._options?.virtualUser }), requestOptions?.headers);
|
|
696
|
+
const _response = await core.fetcher({
|
|
697
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
698
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
699
|
+
environments.IchosEnvironment.Default, `v1/ads/insertion-points/${core.url.encodePathParam(episodeId)}`),
|
|
700
|
+
method: "GET",
|
|
701
|
+
headers: _headers,
|
|
702
|
+
queryParameters: requestOptions?.queryParams,
|
|
703
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
704
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
705
|
+
abortSignal: requestOptions?.abortSignal,
|
|
706
|
+
fetchFn: this._options?.fetch,
|
|
707
|
+
logging: this._options.logging,
|
|
708
|
+
});
|
|
709
|
+
if (_response.ok) {
|
|
710
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
711
|
+
}
|
|
712
|
+
if (_response.error.reason === "status-code") {
|
|
713
|
+
switch (_response.error.statusCode) {
|
|
714
|
+
case 401:
|
|
715
|
+
throw new Ichos.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
716
|
+
case 403:
|
|
717
|
+
throw new Ichos.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
718
|
+
case 404:
|
|
719
|
+
throw new Ichos.NotFoundError(_response.error.body, _response.rawResponse);
|
|
720
|
+
case 500:
|
|
721
|
+
throw new Ichos.InternalServerError(_response.error.body, _response.rawResponse);
|
|
722
|
+
default:
|
|
723
|
+
throw new errors.IchosError({
|
|
724
|
+
statusCode: _response.error.statusCode,
|
|
725
|
+
body: _response.error.body,
|
|
726
|
+
rawResponse: _response.rawResponse,
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ads/insertion-points/{episodeId}");
|
|
731
|
+
}
|
|
732
|
+
}
|