# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Type, Optional, cast
from typing_extensions import Literal

import httpx

from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import path_template, maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
    to_raw_response_wrapper,
    to_streamed_response_wrapper,
    async_to_raw_response_wrapper,
    async_to_streamed_response_wrapper,
)
from ...._wrappers import ResultWrapper
from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from ...._base_client import AsyncPaginator, make_request_options
from ....types.vulnerability_scanner.credential_sets import (
    credential_edit_params,
    credential_list_params,
    credential_create_params,
    credential_update_params,
)
from ....types.vulnerability_scanner.credential_sets.credential_get_response import CredentialGetResponse
from ....types.vulnerability_scanner.credential_sets.credential_edit_response import CredentialEditResponse
from ....types.vulnerability_scanner.credential_sets.credential_list_response import CredentialListResponse
from ....types.vulnerability_scanner.credential_sets.credential_create_response import CredentialCreateResponse
from ....types.vulnerability_scanner.credential_sets.credential_update_response import CredentialUpdateResponse

__all__ = ["CredentialsResource", "AsyncCredentialsResource"]


class CredentialsResource(SyncAPIResource):
    @cached_property
    def with_raw_response(self) -> CredentialsResourceWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
        """
        return CredentialsResourceWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> CredentialsResourceWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
        """
        return CredentialsResourceWithStreamingResponse(self)

    def create(
        self,
        credential_set_id: str,
        *,
        account_id: str,
        location: Literal["header", "cookie"],
        location_name: str,
        name: str,
        value: str,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[CredentialCreateResponse]:
        """
        Creates a new credential within a credential set.

        Args:
          account_id: Identifier.

          location: Where the credential is attached in outgoing requests.

          location_name: Name of the header or cookie where the credential is attached.

          name: Human-readable name.

          value: The credential value (e.g. API key, session token). Write-only. Never returned
              in responses.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        return self._post(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials",
                account_id=account_id,
                credential_set_id=credential_set_id,
            ),
            body=maybe_transform(
                {
                    "location": location,
                    "location_name": location_name,
                    "name": name,
                    "value": value,
                },
                credential_create_params.CredentialCreateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[Optional[CredentialCreateResponse]]._unwrapper,
            ),
            cast_to=cast(Type[Optional[CredentialCreateResponse]], ResultWrapper[CredentialCreateResponse]),
        )

    def update(
        self,
        credential_id: str,
        *,
        account_id: str,
        credential_set_id: str,
        location: Literal["header", "cookie"],
        location_name: str,
        name: str,
        value: str,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[CredentialUpdateResponse]:
        """Replaces a credential.

        All fields must be provided.

        Args:
          account_id: Identifier.

          location: Where the credential is attached in outgoing requests.

          location_name: Name of the header or cookie where the credential is attached.

          name: Human-readable name.

          value: The credential value. Write-only. Never returned in responses.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        if not credential_id:
            raise ValueError(f"Expected a non-empty value for `credential_id` but received {credential_id!r}")
        return self._put(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}",
                account_id=account_id,
                credential_set_id=credential_set_id,
                credential_id=credential_id,
            ),
            body=maybe_transform(
                {
                    "location": location,
                    "location_name": location_name,
                    "name": name,
                    "value": value,
                },
                credential_update_params.CredentialUpdateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[Optional[CredentialUpdateResponse]]._unwrapper,
            ),
            cast_to=cast(Type[Optional[CredentialUpdateResponse]], ResultWrapper[CredentialUpdateResponse]),
        )

    def list(
        self,
        credential_set_id: str,
        *,
        account_id: str,
        page: int | Omit = omit,
        per_page: int | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> SyncV4PagePaginationArray[CredentialListResponse]:
        """
        Returns all credentials within a credential set.

        Args:
          account_id: Identifier.

          page: Page number of paginated results.

          per_page: Number of results per page.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        return self._get_api_list(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials",
                account_id=account_id,
                credential_set_id=credential_set_id,
            ),
            page=SyncV4PagePaginationArray[CredentialListResponse],
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {
                        "page": page,
                        "per_page": per_page,
                    },
                    credential_list_params.CredentialListParams,
                ),
            ),
            model=CredentialListResponse,
        )

    def delete(
        self,
        credential_id: str,
        *,
        account_id: str,
        credential_set_id: str,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> object:
        """
        Deletes a credential.

        Args:
          account_id: Identifier.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        if not credential_id:
            raise ValueError(f"Expected a non-empty value for `credential_id` but received {credential_id!r}")
        return self._delete(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}",
                account_id=account_id,
                credential_set_id=credential_set_id,
                credential_id=credential_id,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[Optional[object]]._unwrapper,
            ),
            cast_to=cast(Type[object], ResultWrapper[object]),
        )

    def edit(
        self,
        credential_id: str,
        *,
        account_id: str,
        credential_set_id: str,
        location: Literal["header", "cookie"] | Omit = omit,
        location_name: str | Omit = omit,
        name: str | Omit = omit,
        value: str | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[CredentialEditResponse]:
        """
        Updates a credential with only the provided fields; omitted fields remain
        unchanged.

        Args:
          account_id: Identifier.

          location: Where the credential is attached in outgoing requests.

          location_name: Name of the header or cookie where the credential is attached.

          name: Human-readable name.

          value: The credential value. Write-only. Never returned in responses.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        if not credential_id:
            raise ValueError(f"Expected a non-empty value for `credential_id` but received {credential_id!r}")
        return self._patch(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}",
                account_id=account_id,
                credential_set_id=credential_set_id,
                credential_id=credential_id,
            ),
            body=maybe_transform(
                {
                    "location": location,
                    "location_name": location_name,
                    "name": name,
                    "value": value,
                },
                credential_edit_params.CredentialEditParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[Optional[CredentialEditResponse]]._unwrapper,
            ),
            cast_to=cast(Type[Optional[CredentialEditResponse]], ResultWrapper[CredentialEditResponse]),
        )

    def get(
        self,
        credential_id: str,
        *,
        account_id: str,
        credential_set_id: str,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[CredentialGetResponse]:
        """
        Returns a single credential by ID.

        Args:
          account_id: Identifier.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        if not credential_id:
            raise ValueError(f"Expected a non-empty value for `credential_id` but received {credential_id!r}")
        return self._get(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}",
                account_id=account_id,
                credential_set_id=credential_set_id,
                credential_id=credential_id,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[Optional[CredentialGetResponse]]._unwrapper,
            ),
            cast_to=cast(Type[Optional[CredentialGetResponse]], ResultWrapper[CredentialGetResponse]),
        )


class AsyncCredentialsResource(AsyncAPIResource):
    @cached_property
    def with_raw_response(self) -> AsyncCredentialsResourceWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
        """
        return AsyncCredentialsResourceWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> AsyncCredentialsResourceWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
        """
        return AsyncCredentialsResourceWithStreamingResponse(self)

    async def create(
        self,
        credential_set_id: str,
        *,
        account_id: str,
        location: Literal["header", "cookie"],
        location_name: str,
        name: str,
        value: str,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[CredentialCreateResponse]:
        """
        Creates a new credential within a credential set.

        Args:
          account_id: Identifier.

          location: Where the credential is attached in outgoing requests.

          location_name: Name of the header or cookie where the credential is attached.

          name: Human-readable name.

          value: The credential value (e.g. API key, session token). Write-only. Never returned
              in responses.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        return await self._post(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials",
                account_id=account_id,
                credential_set_id=credential_set_id,
            ),
            body=await async_maybe_transform(
                {
                    "location": location,
                    "location_name": location_name,
                    "name": name,
                    "value": value,
                },
                credential_create_params.CredentialCreateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[Optional[CredentialCreateResponse]]._unwrapper,
            ),
            cast_to=cast(Type[Optional[CredentialCreateResponse]], ResultWrapper[CredentialCreateResponse]),
        )

    async def update(
        self,
        credential_id: str,
        *,
        account_id: str,
        credential_set_id: str,
        location: Literal["header", "cookie"],
        location_name: str,
        name: str,
        value: str,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[CredentialUpdateResponse]:
        """Replaces a credential.

        All fields must be provided.

        Args:
          account_id: Identifier.

          location: Where the credential is attached in outgoing requests.

          location_name: Name of the header or cookie where the credential is attached.

          name: Human-readable name.

          value: The credential value. Write-only. Never returned in responses.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        if not credential_id:
            raise ValueError(f"Expected a non-empty value for `credential_id` but received {credential_id!r}")
        return await self._put(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}",
                account_id=account_id,
                credential_set_id=credential_set_id,
                credential_id=credential_id,
            ),
            body=await async_maybe_transform(
                {
                    "location": location,
                    "location_name": location_name,
                    "name": name,
                    "value": value,
                },
                credential_update_params.CredentialUpdateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[Optional[CredentialUpdateResponse]]._unwrapper,
            ),
            cast_to=cast(Type[Optional[CredentialUpdateResponse]], ResultWrapper[CredentialUpdateResponse]),
        )

    def list(
        self,
        credential_set_id: str,
        *,
        account_id: str,
        page: int | Omit = omit,
        per_page: int | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> AsyncPaginator[CredentialListResponse, AsyncV4PagePaginationArray[CredentialListResponse]]:
        """
        Returns all credentials within a credential set.

        Args:
          account_id: Identifier.

          page: Page number of paginated results.

          per_page: Number of results per page.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        return self._get_api_list(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials",
                account_id=account_id,
                credential_set_id=credential_set_id,
            ),
            page=AsyncV4PagePaginationArray[CredentialListResponse],
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {
                        "page": page,
                        "per_page": per_page,
                    },
                    credential_list_params.CredentialListParams,
                ),
            ),
            model=CredentialListResponse,
        )

    async def delete(
        self,
        credential_id: str,
        *,
        account_id: str,
        credential_set_id: str,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> object:
        """
        Deletes a credential.

        Args:
          account_id: Identifier.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        if not credential_id:
            raise ValueError(f"Expected a non-empty value for `credential_id` but received {credential_id!r}")
        return await self._delete(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}",
                account_id=account_id,
                credential_set_id=credential_set_id,
                credential_id=credential_id,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[Optional[object]]._unwrapper,
            ),
            cast_to=cast(Type[object], ResultWrapper[object]),
        )

    async def edit(
        self,
        credential_id: str,
        *,
        account_id: str,
        credential_set_id: str,
        location: Literal["header", "cookie"] | Omit = omit,
        location_name: str | Omit = omit,
        name: str | Omit = omit,
        value: str | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[CredentialEditResponse]:
        """
        Updates a credential with only the provided fields; omitted fields remain
        unchanged.

        Args:
          account_id: Identifier.

          location: Where the credential is attached in outgoing requests.

          location_name: Name of the header or cookie where the credential is attached.

          name: Human-readable name.

          value: The credential value. Write-only. Never returned in responses.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        if not credential_id:
            raise ValueError(f"Expected a non-empty value for `credential_id` but received {credential_id!r}")
        return await self._patch(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}",
                account_id=account_id,
                credential_set_id=credential_set_id,
                credential_id=credential_id,
            ),
            body=await async_maybe_transform(
                {
                    "location": location,
                    "location_name": location_name,
                    "name": name,
                    "value": value,
                },
                credential_edit_params.CredentialEditParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[Optional[CredentialEditResponse]]._unwrapper,
            ),
            cast_to=cast(Type[Optional[CredentialEditResponse]], ResultWrapper[CredentialEditResponse]),
        )

    async def get(
        self,
        credential_id: str,
        *,
        account_id: str,
        credential_set_id: str,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[CredentialGetResponse]:
        """
        Returns a single credential by ID.

        Args:
          account_id: Identifier.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not credential_set_id:
            raise ValueError(f"Expected a non-empty value for `credential_set_id` but received {credential_set_id!r}")
        if not credential_id:
            raise ValueError(f"Expected a non-empty value for `credential_id` but received {credential_id!r}")
        return await self._get(
            path_template(
                "/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}",
                account_id=account_id,
                credential_set_id=credential_set_id,
                credential_id=credential_id,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[Optional[CredentialGetResponse]]._unwrapper,
            ),
            cast_to=cast(Type[Optional[CredentialGetResponse]], ResultWrapper[CredentialGetResponse]),
        )


class CredentialsResourceWithRawResponse:
    def __init__(self, credentials: CredentialsResource) -> None:
        self._credentials = credentials

        self.create = to_raw_response_wrapper(
            credentials.create,
        )
        self.update = to_raw_response_wrapper(
            credentials.update,
        )
        self.list = to_raw_response_wrapper(
            credentials.list,
        )
        self.delete = to_raw_response_wrapper(
            credentials.delete,
        )
        self.edit = to_raw_response_wrapper(
            credentials.edit,
        )
        self.get = to_raw_response_wrapper(
            credentials.get,
        )


class AsyncCredentialsResourceWithRawResponse:
    def __init__(self, credentials: AsyncCredentialsResource) -> None:
        self._credentials = credentials

        self.create = async_to_raw_response_wrapper(
            credentials.create,
        )
        self.update = async_to_raw_response_wrapper(
            credentials.update,
        )
        self.list = async_to_raw_response_wrapper(
            credentials.list,
        )
        self.delete = async_to_raw_response_wrapper(
            credentials.delete,
        )
        self.edit = async_to_raw_response_wrapper(
            credentials.edit,
        )
        self.get = async_to_raw_response_wrapper(
            credentials.get,
        )


class CredentialsResourceWithStreamingResponse:
    def __init__(self, credentials: CredentialsResource) -> None:
        self._credentials = credentials

        self.create = to_streamed_response_wrapper(
            credentials.create,
        )
        self.update = to_streamed_response_wrapper(
            credentials.update,
        )
        self.list = to_streamed_response_wrapper(
            credentials.list,
        )
        self.delete = to_streamed_response_wrapper(
            credentials.delete,
        )
        self.edit = to_streamed_response_wrapper(
            credentials.edit,
        )
        self.get = to_streamed_response_wrapper(
            credentials.get,
        )


class AsyncCredentialsResourceWithStreamingResponse:
    def __init__(self, credentials: AsyncCredentialsResource) -> None:
        self._credentials = credentials

        self.create = async_to_streamed_response_wrapper(
            credentials.create,
        )
        self.update = async_to_streamed_response_wrapper(
            credentials.update,
        )
        self.list = async_to_streamed_response_wrapper(
            credentials.list,
        )
        self.delete = async_to_streamed_response_wrapper(
            credentials.delete,
        )
        self.edit = async_to_streamed_response_wrapper(
            credentials.edit,
        )
        self.get = async_to_streamed_response_wrapper(
            credentials.get,
        )
