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

from __future__ import annotations

from typing import Union, Optional
from datetime import date
from typing_extensions import Literal

import httpx

from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ..._utils import 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 ...types.legal import (
    v1_find_params,
    v1_draft_params,
    v1_docket_params,
    v1_verify_params,
    v1_similar_params,
    v1_research_params,
    v1_sec_filing_params,
    v1_list_courts_params,
    v1_get_citations_params,
    v1_get_full_text_params,
    v1_patent_search_params,
    v1_trademark_search_params,
    v1_list_jurisdictions_params,
    v1_get_citations_from_url_params,
)
from ..._base_client import make_request_options
from ...types.legal.v1_find_response import V1FindResponse
from ...types.legal.v1_draft_response import V1DraftResponse
from ...types.legal.v1_docket_response import V1DocketResponse
from ...types.legal.v1_verify_response import V1VerifyResponse
from ...types.legal.v1_similar_response import V1SimilarResponse
from ...types.legal.v1_research_response import V1ResearchResponse
from ...types.legal.v1_sec_filing_response import V1SecFilingResponse
from ...types.legal.v1_list_courts_response import V1ListCourtsResponse
from ...types.legal.v1_get_citations_response import V1GetCitationsResponse
from ...types.legal.v1_get_full_text_response import V1GetFullTextResponse
from ...types.legal.v1_patent_search_response import V1PatentSearchResponse
from ...types.legal.v1_trademark_search_response import V1TrademarkSearchResponse
from ...types.legal.v1_list_jurisdictions_response import V1ListJurisdictionsResponse
from ...types.legal.v1_get_citations_from_url_response import V1GetCitationsFromURLResponse

__all__ = ["V1Resource", "AsyncV1Resource"]


class V1Resource(SyncAPIResource):
    """Legal research tools including citation verification"""

    @cached_property
    def with_raw_response(self) -> V1ResourceWithRawResponse:
        """
        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/CaseMark/casedev-python#accessing-raw-response-data-eg-headers
        """
        return V1ResourceWithRawResponse(self)

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

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

    def docket(
        self,
        *,
        type: Literal["search", "lookup"],
        acknowledge_pacer_fees: bool | Omit = omit,
        court: str | Omit = omit,
        date_filed_after: Union[str, date] | Omit = omit,
        date_filed_before: Union[str, date] | Omit = omit,
        docket_id: str | Omit = omit,
        include_entries: bool | Omit = omit,
        limit: int | Omit = omit,
        live: bool | Omit = omit,
        offset: int | Omit = omit,
        query: 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,
    ) -> V1DocketResponse:
        """
        Search federal court dockets or retrieve a specific docket with optional filing
        entries. Use legal.listCourts() to resolve court slugs for filtering.

        Args:
          type: Search dockets or look up a docket by ID

          acknowledge_pacer_fees: Required when live: true. Acknowledges that PACER fees (up to $3.00 per docket)
              plus a $0.05 service fee will be charged to your account.

          court: Optional court slug for filtering (e.g. "nysd", "ca9", "cafc"). Use
              legal.listCourts() to find slugs.

          date_filed_after: Optional lower bound for filing date (YYYY-MM-DD)

          date_filed_before: Optional upper bound for filing date (YYYY-MM-DD)

          docket_id: Docket ID (required for lookup)

          include_entries: Include docket entries/filings in lookup responses. Coming soon — currently
              returns 501. The parameter is accepted for forward compatibility.

          limit: Page size for search results or entry list (default 25 for search, 50 for
              lookup)

          live: Trigger a live PACER fetch for dockets not yet in the RECAP archive. Requires
              acknowledgePacerFees: true. PACER charges up to $3.00 per docket sheet plus a
              $0.05 service fee. Only valid with type: "lookup".

          offset: Offset for search results or entry list

          query: Case name or party name search query (required for search)

          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
        """
        return self._post(
            "/legal/v1/docket",
            body=maybe_transform(
                {
                    "type": type,
                    "acknowledge_pacer_fees": acknowledge_pacer_fees,
                    "court": court,
                    "date_filed_after": date_filed_after,
                    "date_filed_before": date_filed_before,
                    "docket_id": docket_id,
                    "include_entries": include_entries,
                    "limit": limit,
                    "live": live,
                    "offset": offset,
                    "query": query,
                },
                v1_docket_params.V1DocketParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1DocketResponse,
        )

    def draft(
        self,
        *,
        instructions: str,
        vault_id: str,
        citations: bool | Omit = omit,
        format: Optional[str] | Omit = omit,
        length: Optional[v1_draft_params.Length] | Omit = omit,
        model: Optional[str] | Omit = omit,
        object_ids: Optional[SequenceNotStr[str]] | Omit = omit,
        output_name: Optional[str] | Omit = omit,
        output_type: Literal["pdf", "docx", "xlsx", "pptx", "md"] | Omit = omit,
        verified: bool | 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,
    ) -> V1DraftResponse:
        """Generate a legal document with structured inputs.

        Powered by an agent that
        handles research, formatting, citation verification, and vault upload. Returns a
        run ID for polling.

        Args:
          instructions: What to draft — the core task. E.g., "Motion to compel defendant to produce
              discovery responses"

          vault_id: Vault ID where the final document will be uploaded

          citations: Research and include legal citations

          format: Court or jurisdiction formatting hint. Triggers a legal-skills search. E.g.,
              "California Superior Court", "SDNY", "federal pleading"

          length: Target document length

          model: LLM model override. Defaults to anthropic/claude-sonnet-4.6

          object_ids: Vault object IDs to use as source/reference documents

          output_name: Filename for the output document. Auto-generated if omitted.

          output_type: Output file format

          verified: Verify all citations in a loop — re-run verification and repair bad citations
              until they pass

          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
        """
        return self._post(
            "/legal/v1/draft",
            body=maybe_transform(
                {
                    "instructions": instructions,
                    "vault_id": vault_id,
                    "citations": citations,
                    "format": format,
                    "length": length,
                    "model": model,
                    "object_ids": object_ids,
                    "output_name": output_name,
                    "output_type": output_type,
                    "verified": verified,
                },
                v1_draft_params.V1DraftParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1DraftResponse,
        )

    def find(
        self,
        *,
        query: str,
        jurisdiction: str | Omit = omit,
        num_results: 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,
    ) -> V1FindResponse:
        """
        Search for legal sources including cases, statutes, and regulations from
        authoritative legal databases. Returns ranked candidates. Always verify with
        legal.verify() before citing.

        Args:
          query: Search query (e.g., "fair use copyright", "Miranda rights")

          jurisdiction: Optional jurisdiction ID from resolveJurisdiction (e.g., "california",
              "us-federal")

          num_results: Number of results 1-25 (default: 10)

          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
        """
        return self._post(
            "/legal/v1/find",
            body=maybe_transform(
                {
                    "query": query,
                    "jurisdiction": jurisdiction,
                    "num_results": num_results,
                },
                v1_find_params.V1FindParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1FindResponse,
        )

    def get_citations(
        self,
        *,
        text: 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,
    ) -> V1GetCitationsResponse:
        """
        Parses legal citations from text and returns structured Bluebook components
        (case name, reporter, volume, page, year, court). Accepts either a single
        citation or a full text block.

        Args:
          text: Text containing citations to extract. Can be a single citation (e.g., "531 U.S.
              98") or a full document with multiple citations.

          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
        """
        return self._post(
            "/legal/v1/citations",
            body=maybe_transform({"text": text}, v1_get_citations_params.V1GetCitationsParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1GetCitationsResponse,
        )

    def get_citations_from_url(
        self,
        *,
        url: 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,
    ) -> V1GetCitationsFromURLResponse:
        """Extract all legal citations and references from a document URL.

        Returns
        structured citation data including case citations, statute references, and
        regulatory citations.

        Args:
          url: URL of the legal document to extract citations from

          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
        """
        return self._post(
            "/legal/v1/citations-from-url",
            body=maybe_transform({"url": url}, v1_get_citations_from_url_params.V1GetCitationsFromURLParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1GetCitationsFromURLResponse,
        )

    def get_full_text(
        self,
        *,
        url: str,
        highlight_query: str | Omit = omit,
        max_characters: int | Omit = omit,
        summary_query: 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,
    ) -> V1GetFullTextResponse:
        """Retrieve the full text content of a legal document.

        Use after verifying the
        source with legal.verify(). Returns complete text with optional highlights and
        AI summary.

        Args:
          url: URL of the verified legal document

          highlight_query: Optional query to extract relevant highlights (e.g., "What is the holding?")

          max_characters: Maximum characters to return (default: 10000, max: 50000)

          summary_query: Optional query for generating a summary (e.g., "Summarize the key ruling")

          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
        """
        return self._post(
            "/legal/v1/full-text",
            body=maybe_transform(
                {
                    "url": url,
                    "highlight_query": highlight_query,
                    "max_characters": max_characters,
                    "summary_query": summary_query,
                },
                v1_get_full_text_params.V1GetFullTextParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1GetFullTextResponse,
        )

    def list_courts(
        self,
        *,
        in_use_only: bool | Omit = omit,
        jurisdiction: str | Omit = omit,
        limit: int | Omit = omit,
        offset: int | Omit = omit,
        query: 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,
    ) -> V1ListCourtsResponse:
        """Returns court IDs (slugs) and names for use with the docket search endpoint.

        Use
        the returned court ID as the `court` parameter in legal.docket().

        Args:
          in_use_only: Only return courts with available docket data

          jurisdiction: Optional jurisdiction code filter (e.g. FD for Federal District, F for all
              Federal, S for State)

          limit: Maximum number of courts to return

          offset: Number of courts to skip before returning results

          query: Search by court name or slug (e.g. "Northern District", "nysd", "ca9")

          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
        """
        return self._post(
            "/legal/v1/courts",
            body=maybe_transform(
                {
                    "in_use_only": in_use_only,
                    "jurisdiction": jurisdiction,
                    "limit": limit,
                    "offset": offset,
                    "query": query,
                },
                v1_list_courts_params.V1ListCourtsParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1ListCourtsResponse,
        )

    def list_jurisdictions(
        self,
        *,
        name: 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,
    ) -> V1ListJurisdictionsResponse:
        """Search for a jurisdiction by name.

        Returns matching jurisdictions with their IDs
        for use in legal.find() and other legal research endpoints.

        Args:
          name: Jurisdiction name (e.g., "California", "US Federal", "NY")

          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
        """
        return self._post(
            "/legal/v1/jurisdictions",
            body=maybe_transform({"name": name}, v1_list_jurisdictions_params.V1ListJurisdictionsParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1ListJurisdictionsResponse,
        )

    def patent_search(
        self,
        *,
        query: str,
        application_status: str | Omit = omit,
        application_type: Literal["Utility", "Design", "Plant", "Provisional", "Reissue"] | Omit = omit,
        assignee: str | Omit = omit,
        filing_date_from: Union[str, date] | Omit = omit,
        filing_date_to: Union[str, date] | Omit = omit,
        grant_date_from: Union[str, date] | Omit = omit,
        grant_date_to: Union[str, date] | Omit = omit,
        inventor: str | Omit = omit,
        limit: int | Omit = omit,
        offset: int | Omit = omit,
        sort_by: Literal["filingDate", "grantDate"] | Omit = omit,
        sort_order: Literal["asc", "desc"] | 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,
    ) -> V1PatentSearchResponse:
        """Search the USPTO Open Data Portal for US patent applications and granted
        patents.

        Supports free-text queries, field-specific search, filters by
        assignee/inventor/status/type, date ranges, and pagination. Covers applications
        filed on or after January 1, 2001. Data is refreshed daily.

        Args:
          query: Free-text search across all patent fields, or field-specific query (e.g.
              "applicationMetaData.patentNumber:11234567"). Supports AND, OR, NOT operators.

          application_status: Filter by application status (e.g. "Patented Case", "Abandoned", "Pending")

          application_type: Filter by application type

          assignee: Filter by assignee/owner name (e.g. "Google LLC")

          filing_date_from: Start of filing date range (YYYY-MM-DD)

          filing_date_to: End of filing date range (YYYY-MM-DD)

          grant_date_from: Start of grant date range (YYYY-MM-DD)

          grant_date_to: End of grant date range (YYYY-MM-DD)

          inventor: Filter by inventor name

          limit: Number of results to return (default 25, max 100)

          offset: Starting position for pagination

          sort_by: Field to sort results by

          sort_order: Sort order (default desc, newest first)

          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
        """
        return self._post(
            "/legal/v1/patent-search",
            body=maybe_transform(
                {
                    "query": query,
                    "application_status": application_status,
                    "application_type": application_type,
                    "assignee": assignee,
                    "filing_date_from": filing_date_from,
                    "filing_date_to": filing_date_to,
                    "grant_date_from": grant_date_from,
                    "grant_date_to": grant_date_to,
                    "inventor": inventor,
                    "limit": limit,
                    "offset": offset,
                    "sort_by": sort_by,
                    "sort_order": sort_order,
                },
                v1_patent_search_params.V1PatentSearchParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1PatentSearchResponse,
        )

    def research(
        self,
        *,
        query: str,
        additional_queries: SequenceNotStr[str] | Omit = omit,
        jurisdiction: str | Omit = omit,
        num_results: 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,
    ) -> V1ResearchResponse:
        """Perform comprehensive legal research with multiple query variations.

        Uses
        advanced deep search to find relevant sources across different phrasings of the
        legal issue.

        Args:
          query: Primary search query

          additional_queries: Additional query variations to search (e.g., different phrasings of the legal
              issue)

          jurisdiction: Optional jurisdiction ID from resolveJurisdiction

          num_results: Number of results 1-25 (default: 10)

          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
        """
        return self._post(
            "/legal/v1/research",
            body=maybe_transform(
                {
                    "query": query,
                    "additional_queries": additional_queries,
                    "jurisdiction": jurisdiction,
                    "num_results": num_results,
                },
                v1_research_params.V1ResearchParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1ResearchResponse,
        )

    def sec_filing(
        self,
        *,
        type: Literal["search", "entity"],
        cik: str | Omit = omit,
        date_after: Union[str, date] | Omit = omit,
        date_before: Union[str, date] | Omit = omit,
        entity: str | Omit = omit,
        form_types: SequenceNotStr[str] | Omit = omit,
        limit: int | Omit = omit,
        offset: int | Omit = omit,
        query: str | Omit = omit,
        ticker: 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,
    ) -> V1SecFilingResponse:
        """
        Search SEC EDGAR full-text filings via efts.sec.gov or fetch a filer's
        structured filing history via data.sec.gov. Returns direct SEC archive URLs with
        filing metadata and match snippets when available.

        Args:
          type: Run a full-text search or fetch a single entity filing history

          cik: CIK for entity lookups. Accepts padded or unpadded digits.

          date_after: Optional lower filing date bound (YYYY-MM-DD)

          date_before: Optional upper filing date bound (YYYY-MM-DD)

          entity: Optional entity filter passed through to EDGAR full-text search

          form_types: Optional SEC form type filter such as 10-K, 10-Q, 8-K, or 4

          limit: Maximum filings to return

          offset: Result offset for pagination

          query: Full-text SEC search query (required for type: search)

          ticker: Optional company ticker. Valid for both search and entity lookups.

          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
        """
        return self._post(
            "/legal/v1/sec-filing",
            body=maybe_transform(
                {
                    "type": type,
                    "cik": cik,
                    "date_after": date_after,
                    "date_before": date_before,
                    "entity": entity,
                    "form_types": form_types,
                    "limit": limit,
                    "offset": offset,
                    "query": query,
                    "ticker": ticker,
                },
                v1_sec_filing_params.V1SecFilingParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1SecFilingResponse,
        )

    def similar(
        self,
        *,
        url: str,
        jurisdiction: str | Omit = omit,
        num_results: int | Omit = omit,
        start_published_date: Union[str, date] | 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,
    ) -> V1SimilarResponse:
        """Find cases and documents similar to a given legal source.

        Useful for finding
        citing cases, related precedents, or similar statutes.

        Args:
          url: URL of a legal document to find similar sources for

          jurisdiction: Optional jurisdiction ID to filter results

          num_results: Number of results 1-25 (default: 10)

          start_published_date: Optional ISO date to find only newer documents (e.g., "2020-01-01")

          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
        """
        return self._post(
            "/legal/v1/similar",
            body=maybe_transform(
                {
                    "url": url,
                    "jurisdiction": jurisdiction,
                    "num_results": num_results,
                    "start_published_date": start_published_date,
                },
                v1_similar_params.V1SimilarParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1SimilarResponse,
        )

    def trademark_search(
        self,
        *,
        registration_number: str | Omit = omit,
        serial_number: 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,
    ) -> V1TrademarkSearchResponse:
        """
        Look up trademark status and details from the USPTO Trademark Status & Document
        Retrieval (TSDR) system. Supports lookup by serial number or registration
        number. Returns mark text, status, owner, goods/services, Nice classification,
        filing/registration dates, and more.

        Args:
          registration_number: USPTO registration number (e.g. "6123456"). Provide either serialNumber or
              registrationNumber.

          serial_number: USPTO serial number (e.g. "97123456"). Provide either serialNumber or
              registrationNumber.

          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
        """
        return self._post(
            "/legal/v1/trademark-search",
            body=maybe_transform(
                {
                    "registration_number": registration_number,
                    "serial_number": serial_number,
                },
                v1_trademark_search_params.V1TrademarkSearchParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1TrademarkSearchResponse,
        )

    def verify(
        self,
        *,
        text: 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,
    ) -> V1VerifyResponse:
        """
        Validates legal citations against authoritative case law sources (CourtListener
        database of ~10M cases). Returns verification status and case metadata for each
        citation found in the input text. Accepts either a single citation or a full
        text block containing multiple citations.

        Args:
          text: Text containing citations to verify. Can be a single citation (e.g., "531 U.S.
              98") or a full document with multiple citations.

          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
        """
        return self._post(
            "/legal/v1/verify",
            body=maybe_transform({"text": text}, v1_verify_params.V1VerifyParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1VerifyResponse,
        )


class AsyncV1Resource(AsyncAPIResource):
    """Legal research tools including citation verification"""

    @cached_property
    def with_raw_response(self) -> AsyncV1ResourceWithRawResponse:
        """
        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/CaseMark/casedev-python#accessing-raw-response-data-eg-headers
        """
        return AsyncV1ResourceWithRawResponse(self)

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

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

    async def docket(
        self,
        *,
        type: Literal["search", "lookup"],
        acknowledge_pacer_fees: bool | Omit = omit,
        court: str | Omit = omit,
        date_filed_after: Union[str, date] | Omit = omit,
        date_filed_before: Union[str, date] | Omit = omit,
        docket_id: str | Omit = omit,
        include_entries: bool | Omit = omit,
        limit: int | Omit = omit,
        live: bool | Omit = omit,
        offset: int | Omit = omit,
        query: 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,
    ) -> V1DocketResponse:
        """
        Search federal court dockets or retrieve a specific docket with optional filing
        entries. Use legal.listCourts() to resolve court slugs for filtering.

        Args:
          type: Search dockets or look up a docket by ID

          acknowledge_pacer_fees: Required when live: true. Acknowledges that PACER fees (up to $3.00 per docket)
              plus a $0.05 service fee will be charged to your account.

          court: Optional court slug for filtering (e.g. "nysd", "ca9", "cafc"). Use
              legal.listCourts() to find slugs.

          date_filed_after: Optional lower bound for filing date (YYYY-MM-DD)

          date_filed_before: Optional upper bound for filing date (YYYY-MM-DD)

          docket_id: Docket ID (required for lookup)

          include_entries: Include docket entries/filings in lookup responses. Coming soon — currently
              returns 501. The parameter is accepted for forward compatibility.

          limit: Page size for search results or entry list (default 25 for search, 50 for
              lookup)

          live: Trigger a live PACER fetch for dockets not yet in the RECAP archive. Requires
              acknowledgePacerFees: true. PACER charges up to $3.00 per docket sheet plus a
              $0.05 service fee. Only valid with type: "lookup".

          offset: Offset for search results or entry list

          query: Case name or party name search query (required for search)

          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
        """
        return await self._post(
            "/legal/v1/docket",
            body=await async_maybe_transform(
                {
                    "type": type,
                    "acknowledge_pacer_fees": acknowledge_pacer_fees,
                    "court": court,
                    "date_filed_after": date_filed_after,
                    "date_filed_before": date_filed_before,
                    "docket_id": docket_id,
                    "include_entries": include_entries,
                    "limit": limit,
                    "live": live,
                    "offset": offset,
                    "query": query,
                },
                v1_docket_params.V1DocketParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1DocketResponse,
        )

    async def draft(
        self,
        *,
        instructions: str,
        vault_id: str,
        citations: bool | Omit = omit,
        format: Optional[str] | Omit = omit,
        length: Optional[v1_draft_params.Length] | Omit = omit,
        model: Optional[str] | Omit = omit,
        object_ids: Optional[SequenceNotStr[str]] | Omit = omit,
        output_name: Optional[str] | Omit = omit,
        output_type: Literal["pdf", "docx", "xlsx", "pptx", "md"] | Omit = omit,
        verified: bool | 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,
    ) -> V1DraftResponse:
        """Generate a legal document with structured inputs.

        Powered by an agent that
        handles research, formatting, citation verification, and vault upload. Returns a
        run ID for polling.

        Args:
          instructions: What to draft — the core task. E.g., "Motion to compel defendant to produce
              discovery responses"

          vault_id: Vault ID where the final document will be uploaded

          citations: Research and include legal citations

          format: Court or jurisdiction formatting hint. Triggers a legal-skills search. E.g.,
              "California Superior Court", "SDNY", "federal pleading"

          length: Target document length

          model: LLM model override. Defaults to anthropic/claude-sonnet-4.6

          object_ids: Vault object IDs to use as source/reference documents

          output_name: Filename for the output document. Auto-generated if omitted.

          output_type: Output file format

          verified: Verify all citations in a loop — re-run verification and repair bad citations
              until they pass

          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
        """
        return await self._post(
            "/legal/v1/draft",
            body=await async_maybe_transform(
                {
                    "instructions": instructions,
                    "vault_id": vault_id,
                    "citations": citations,
                    "format": format,
                    "length": length,
                    "model": model,
                    "object_ids": object_ids,
                    "output_name": output_name,
                    "output_type": output_type,
                    "verified": verified,
                },
                v1_draft_params.V1DraftParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1DraftResponse,
        )

    async def find(
        self,
        *,
        query: str,
        jurisdiction: str | Omit = omit,
        num_results: 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,
    ) -> V1FindResponse:
        """
        Search for legal sources including cases, statutes, and regulations from
        authoritative legal databases. Returns ranked candidates. Always verify with
        legal.verify() before citing.

        Args:
          query: Search query (e.g., "fair use copyright", "Miranda rights")

          jurisdiction: Optional jurisdiction ID from resolveJurisdiction (e.g., "california",
              "us-federal")

          num_results: Number of results 1-25 (default: 10)

          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
        """
        return await self._post(
            "/legal/v1/find",
            body=await async_maybe_transform(
                {
                    "query": query,
                    "jurisdiction": jurisdiction,
                    "num_results": num_results,
                },
                v1_find_params.V1FindParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1FindResponse,
        )

    async def get_citations(
        self,
        *,
        text: 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,
    ) -> V1GetCitationsResponse:
        """
        Parses legal citations from text and returns structured Bluebook components
        (case name, reporter, volume, page, year, court). Accepts either a single
        citation or a full text block.

        Args:
          text: Text containing citations to extract. Can be a single citation (e.g., "531 U.S.
              98") or a full document with multiple citations.

          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
        """
        return await self._post(
            "/legal/v1/citations",
            body=await async_maybe_transform({"text": text}, v1_get_citations_params.V1GetCitationsParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1GetCitationsResponse,
        )

    async def get_citations_from_url(
        self,
        *,
        url: 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,
    ) -> V1GetCitationsFromURLResponse:
        """Extract all legal citations and references from a document URL.

        Returns
        structured citation data including case citations, statute references, and
        regulatory citations.

        Args:
          url: URL of the legal document to extract citations from

          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
        """
        return await self._post(
            "/legal/v1/citations-from-url",
            body=await async_maybe_transform(
                {"url": url}, v1_get_citations_from_url_params.V1GetCitationsFromURLParams
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1GetCitationsFromURLResponse,
        )

    async def get_full_text(
        self,
        *,
        url: str,
        highlight_query: str | Omit = omit,
        max_characters: int | Omit = omit,
        summary_query: 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,
    ) -> V1GetFullTextResponse:
        """Retrieve the full text content of a legal document.

        Use after verifying the
        source with legal.verify(). Returns complete text with optional highlights and
        AI summary.

        Args:
          url: URL of the verified legal document

          highlight_query: Optional query to extract relevant highlights (e.g., "What is the holding?")

          max_characters: Maximum characters to return (default: 10000, max: 50000)

          summary_query: Optional query for generating a summary (e.g., "Summarize the key ruling")

          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
        """
        return await self._post(
            "/legal/v1/full-text",
            body=await async_maybe_transform(
                {
                    "url": url,
                    "highlight_query": highlight_query,
                    "max_characters": max_characters,
                    "summary_query": summary_query,
                },
                v1_get_full_text_params.V1GetFullTextParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1GetFullTextResponse,
        )

    async def list_courts(
        self,
        *,
        in_use_only: bool | Omit = omit,
        jurisdiction: str | Omit = omit,
        limit: int | Omit = omit,
        offset: int | Omit = omit,
        query: 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,
    ) -> V1ListCourtsResponse:
        """Returns court IDs (slugs) and names for use with the docket search endpoint.

        Use
        the returned court ID as the `court` parameter in legal.docket().

        Args:
          in_use_only: Only return courts with available docket data

          jurisdiction: Optional jurisdiction code filter (e.g. FD for Federal District, F for all
              Federal, S for State)

          limit: Maximum number of courts to return

          offset: Number of courts to skip before returning results

          query: Search by court name or slug (e.g. "Northern District", "nysd", "ca9")

          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
        """
        return await self._post(
            "/legal/v1/courts",
            body=await async_maybe_transform(
                {
                    "in_use_only": in_use_only,
                    "jurisdiction": jurisdiction,
                    "limit": limit,
                    "offset": offset,
                    "query": query,
                },
                v1_list_courts_params.V1ListCourtsParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1ListCourtsResponse,
        )

    async def list_jurisdictions(
        self,
        *,
        name: 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,
    ) -> V1ListJurisdictionsResponse:
        """Search for a jurisdiction by name.

        Returns matching jurisdictions with their IDs
        for use in legal.find() and other legal research endpoints.

        Args:
          name: Jurisdiction name (e.g., "California", "US Federal", "NY")

          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
        """
        return await self._post(
            "/legal/v1/jurisdictions",
            body=await async_maybe_transform({"name": name}, v1_list_jurisdictions_params.V1ListJurisdictionsParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1ListJurisdictionsResponse,
        )

    async def patent_search(
        self,
        *,
        query: str,
        application_status: str | Omit = omit,
        application_type: Literal["Utility", "Design", "Plant", "Provisional", "Reissue"] | Omit = omit,
        assignee: str | Omit = omit,
        filing_date_from: Union[str, date] | Omit = omit,
        filing_date_to: Union[str, date] | Omit = omit,
        grant_date_from: Union[str, date] | Omit = omit,
        grant_date_to: Union[str, date] | Omit = omit,
        inventor: str | Omit = omit,
        limit: int | Omit = omit,
        offset: int | Omit = omit,
        sort_by: Literal["filingDate", "grantDate"] | Omit = omit,
        sort_order: Literal["asc", "desc"] | 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,
    ) -> V1PatentSearchResponse:
        """Search the USPTO Open Data Portal for US patent applications and granted
        patents.

        Supports free-text queries, field-specific search, filters by
        assignee/inventor/status/type, date ranges, and pagination. Covers applications
        filed on or after January 1, 2001. Data is refreshed daily.

        Args:
          query: Free-text search across all patent fields, or field-specific query (e.g.
              "applicationMetaData.patentNumber:11234567"). Supports AND, OR, NOT operators.

          application_status: Filter by application status (e.g. "Patented Case", "Abandoned", "Pending")

          application_type: Filter by application type

          assignee: Filter by assignee/owner name (e.g. "Google LLC")

          filing_date_from: Start of filing date range (YYYY-MM-DD)

          filing_date_to: End of filing date range (YYYY-MM-DD)

          grant_date_from: Start of grant date range (YYYY-MM-DD)

          grant_date_to: End of grant date range (YYYY-MM-DD)

          inventor: Filter by inventor name

          limit: Number of results to return (default 25, max 100)

          offset: Starting position for pagination

          sort_by: Field to sort results by

          sort_order: Sort order (default desc, newest first)

          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
        """
        return await self._post(
            "/legal/v1/patent-search",
            body=await async_maybe_transform(
                {
                    "query": query,
                    "application_status": application_status,
                    "application_type": application_type,
                    "assignee": assignee,
                    "filing_date_from": filing_date_from,
                    "filing_date_to": filing_date_to,
                    "grant_date_from": grant_date_from,
                    "grant_date_to": grant_date_to,
                    "inventor": inventor,
                    "limit": limit,
                    "offset": offset,
                    "sort_by": sort_by,
                    "sort_order": sort_order,
                },
                v1_patent_search_params.V1PatentSearchParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1PatentSearchResponse,
        )

    async def research(
        self,
        *,
        query: str,
        additional_queries: SequenceNotStr[str] | Omit = omit,
        jurisdiction: str | Omit = omit,
        num_results: 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,
    ) -> V1ResearchResponse:
        """Perform comprehensive legal research with multiple query variations.

        Uses
        advanced deep search to find relevant sources across different phrasings of the
        legal issue.

        Args:
          query: Primary search query

          additional_queries: Additional query variations to search (e.g., different phrasings of the legal
              issue)

          jurisdiction: Optional jurisdiction ID from resolveJurisdiction

          num_results: Number of results 1-25 (default: 10)

          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
        """
        return await self._post(
            "/legal/v1/research",
            body=await async_maybe_transform(
                {
                    "query": query,
                    "additional_queries": additional_queries,
                    "jurisdiction": jurisdiction,
                    "num_results": num_results,
                },
                v1_research_params.V1ResearchParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1ResearchResponse,
        )

    async def sec_filing(
        self,
        *,
        type: Literal["search", "entity"],
        cik: str | Omit = omit,
        date_after: Union[str, date] | Omit = omit,
        date_before: Union[str, date] | Omit = omit,
        entity: str | Omit = omit,
        form_types: SequenceNotStr[str] | Omit = omit,
        limit: int | Omit = omit,
        offset: int | Omit = omit,
        query: str | Omit = omit,
        ticker: 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,
    ) -> V1SecFilingResponse:
        """
        Search SEC EDGAR full-text filings via efts.sec.gov or fetch a filer's
        structured filing history via data.sec.gov. Returns direct SEC archive URLs with
        filing metadata and match snippets when available.

        Args:
          type: Run a full-text search or fetch a single entity filing history

          cik: CIK for entity lookups. Accepts padded or unpadded digits.

          date_after: Optional lower filing date bound (YYYY-MM-DD)

          date_before: Optional upper filing date bound (YYYY-MM-DD)

          entity: Optional entity filter passed through to EDGAR full-text search

          form_types: Optional SEC form type filter such as 10-K, 10-Q, 8-K, or 4

          limit: Maximum filings to return

          offset: Result offset for pagination

          query: Full-text SEC search query (required for type: search)

          ticker: Optional company ticker. Valid for both search and entity lookups.

          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
        """
        return await self._post(
            "/legal/v1/sec-filing",
            body=await async_maybe_transform(
                {
                    "type": type,
                    "cik": cik,
                    "date_after": date_after,
                    "date_before": date_before,
                    "entity": entity,
                    "form_types": form_types,
                    "limit": limit,
                    "offset": offset,
                    "query": query,
                    "ticker": ticker,
                },
                v1_sec_filing_params.V1SecFilingParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1SecFilingResponse,
        )

    async def similar(
        self,
        *,
        url: str,
        jurisdiction: str | Omit = omit,
        num_results: int | Omit = omit,
        start_published_date: Union[str, date] | 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,
    ) -> V1SimilarResponse:
        """Find cases and documents similar to a given legal source.

        Useful for finding
        citing cases, related precedents, or similar statutes.

        Args:
          url: URL of a legal document to find similar sources for

          jurisdiction: Optional jurisdiction ID to filter results

          num_results: Number of results 1-25 (default: 10)

          start_published_date: Optional ISO date to find only newer documents (e.g., "2020-01-01")

          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
        """
        return await self._post(
            "/legal/v1/similar",
            body=await async_maybe_transform(
                {
                    "url": url,
                    "jurisdiction": jurisdiction,
                    "num_results": num_results,
                    "start_published_date": start_published_date,
                },
                v1_similar_params.V1SimilarParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1SimilarResponse,
        )

    async def trademark_search(
        self,
        *,
        registration_number: str | Omit = omit,
        serial_number: 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,
    ) -> V1TrademarkSearchResponse:
        """
        Look up trademark status and details from the USPTO Trademark Status & Document
        Retrieval (TSDR) system. Supports lookup by serial number or registration
        number. Returns mark text, status, owner, goods/services, Nice classification,
        filing/registration dates, and more.

        Args:
          registration_number: USPTO registration number (e.g. "6123456"). Provide either serialNumber or
              registrationNumber.

          serial_number: USPTO serial number (e.g. "97123456"). Provide either serialNumber or
              registrationNumber.

          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
        """
        return await self._post(
            "/legal/v1/trademark-search",
            body=await async_maybe_transform(
                {
                    "registration_number": registration_number,
                    "serial_number": serial_number,
                },
                v1_trademark_search_params.V1TrademarkSearchParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1TrademarkSearchResponse,
        )

    async def verify(
        self,
        *,
        text: 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,
    ) -> V1VerifyResponse:
        """
        Validates legal citations against authoritative case law sources (CourtListener
        database of ~10M cases). Returns verification status and case metadata for each
        citation found in the input text. Accepts either a single citation or a full
        text block containing multiple citations.

        Args:
          text: Text containing citations to verify. Can be a single citation (e.g., "531 U.S.
              98") or a full document with multiple citations.

          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
        """
        return await self._post(
            "/legal/v1/verify",
            body=await async_maybe_transform({"text": text}, v1_verify_params.V1VerifyParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=V1VerifyResponse,
        )


class V1ResourceWithRawResponse:
    def __init__(self, v1: V1Resource) -> None:
        self._v1 = v1

        self.docket = to_raw_response_wrapper(
            v1.docket,
        )
        self.draft = to_raw_response_wrapper(
            v1.draft,
        )
        self.find = to_raw_response_wrapper(
            v1.find,
        )
        self.get_citations = to_raw_response_wrapper(
            v1.get_citations,
        )
        self.get_citations_from_url = to_raw_response_wrapper(
            v1.get_citations_from_url,
        )
        self.get_full_text = to_raw_response_wrapper(
            v1.get_full_text,
        )
        self.list_courts = to_raw_response_wrapper(
            v1.list_courts,
        )
        self.list_jurisdictions = to_raw_response_wrapper(
            v1.list_jurisdictions,
        )
        self.patent_search = to_raw_response_wrapper(
            v1.patent_search,
        )
        self.research = to_raw_response_wrapper(
            v1.research,
        )
        self.sec_filing = to_raw_response_wrapper(
            v1.sec_filing,
        )
        self.similar = to_raw_response_wrapper(
            v1.similar,
        )
        self.trademark_search = to_raw_response_wrapper(
            v1.trademark_search,
        )
        self.verify = to_raw_response_wrapper(
            v1.verify,
        )


class AsyncV1ResourceWithRawResponse:
    def __init__(self, v1: AsyncV1Resource) -> None:
        self._v1 = v1

        self.docket = async_to_raw_response_wrapper(
            v1.docket,
        )
        self.draft = async_to_raw_response_wrapper(
            v1.draft,
        )
        self.find = async_to_raw_response_wrapper(
            v1.find,
        )
        self.get_citations = async_to_raw_response_wrapper(
            v1.get_citations,
        )
        self.get_citations_from_url = async_to_raw_response_wrapper(
            v1.get_citations_from_url,
        )
        self.get_full_text = async_to_raw_response_wrapper(
            v1.get_full_text,
        )
        self.list_courts = async_to_raw_response_wrapper(
            v1.list_courts,
        )
        self.list_jurisdictions = async_to_raw_response_wrapper(
            v1.list_jurisdictions,
        )
        self.patent_search = async_to_raw_response_wrapper(
            v1.patent_search,
        )
        self.research = async_to_raw_response_wrapper(
            v1.research,
        )
        self.sec_filing = async_to_raw_response_wrapper(
            v1.sec_filing,
        )
        self.similar = async_to_raw_response_wrapper(
            v1.similar,
        )
        self.trademark_search = async_to_raw_response_wrapper(
            v1.trademark_search,
        )
        self.verify = async_to_raw_response_wrapper(
            v1.verify,
        )


class V1ResourceWithStreamingResponse:
    def __init__(self, v1: V1Resource) -> None:
        self._v1 = v1

        self.docket = to_streamed_response_wrapper(
            v1.docket,
        )
        self.draft = to_streamed_response_wrapper(
            v1.draft,
        )
        self.find = to_streamed_response_wrapper(
            v1.find,
        )
        self.get_citations = to_streamed_response_wrapper(
            v1.get_citations,
        )
        self.get_citations_from_url = to_streamed_response_wrapper(
            v1.get_citations_from_url,
        )
        self.get_full_text = to_streamed_response_wrapper(
            v1.get_full_text,
        )
        self.list_courts = to_streamed_response_wrapper(
            v1.list_courts,
        )
        self.list_jurisdictions = to_streamed_response_wrapper(
            v1.list_jurisdictions,
        )
        self.patent_search = to_streamed_response_wrapper(
            v1.patent_search,
        )
        self.research = to_streamed_response_wrapper(
            v1.research,
        )
        self.sec_filing = to_streamed_response_wrapper(
            v1.sec_filing,
        )
        self.similar = to_streamed_response_wrapper(
            v1.similar,
        )
        self.trademark_search = to_streamed_response_wrapper(
            v1.trademark_search,
        )
        self.verify = to_streamed_response_wrapper(
            v1.verify,
        )


class AsyncV1ResourceWithStreamingResponse:
    def __init__(self, v1: AsyncV1Resource) -> None:
        self._v1 = v1

        self.docket = async_to_streamed_response_wrapper(
            v1.docket,
        )
        self.draft = async_to_streamed_response_wrapper(
            v1.draft,
        )
        self.find = async_to_streamed_response_wrapper(
            v1.find,
        )
        self.get_citations = async_to_streamed_response_wrapper(
            v1.get_citations,
        )
        self.get_citations_from_url = async_to_streamed_response_wrapper(
            v1.get_citations_from_url,
        )
        self.get_full_text = async_to_streamed_response_wrapper(
            v1.get_full_text,
        )
        self.list_courts = async_to_streamed_response_wrapper(
            v1.list_courts,
        )
        self.list_jurisdictions = async_to_streamed_response_wrapper(
            v1.list_jurisdictions,
        )
        self.patent_search = async_to_streamed_response_wrapper(
            v1.patent_search,
        )
        self.research = async_to_streamed_response_wrapper(
            v1.research,
        )
        self.sec_filing = async_to_streamed_response_wrapper(
            v1.sec_filing,
        )
        self.similar = async_to_streamed_response_wrapper(
            v1.similar,
        )
        self.trademark_search = async_to_streamed_response_wrapper(
            v1.trademark_search,
        )
        self.verify = async_to_streamed_response_wrapper(
            v1.verify,
        )
