From c7960be6e2cdc69d9715454585ab23686bac0805 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 17:47:32 +0000 Subject: [PATCH] chore: updates --- .stats.yml | 4 +- api.md | 104 ++ src/runloop_api_client/_client.py | 10 +- src/runloop_api_client/resources/__init__.py | 14 + .../resources/devboxes/__init__.py | 14 + .../resources/devboxes/devboxes.py | 32 + .../resources/devboxes/lsp.py | 1461 +++++++++++++++ .../resources/repositories.py | 528 ++++++ src/runloop_api_client/types/__init__.py | 6 + .../types/devboxes/__init__.py | 67 + .../types/devboxes/base_code_action.py | 21 + .../types/devboxes/base_command.py | 15 + .../types/devboxes/base_command_param.py | 16 + .../types/devboxes/base_diagnostic.py | 22 + .../types/devboxes/base_diagnostic_param.py | 24 + .../types/devboxes/base_location.py | 13 + .../types/devboxes/base_markup_content.py | 12 + .../devboxes/base_parameter_information.py | 17 + .../types/devboxes/base_range.py | 24 + .../types/devboxes/base_range_param.py | 25 + .../types/devboxes/base_signature.py | 20 + .../types/devboxes/base_workspace_edit.py | 13 + .../devboxes/base_workspace_edit_param.py | 14 + .../code_action_application_result.py | 17 + .../devboxes/code_action_context_param.py | 34 + .../types/devboxes/code_action_kind.py | 7 + .../devboxes/code_action_trigger_kind.py | 7 + .../types/devboxes/code_description_param.py | 14 + .../devboxes/code_segment_info_response.py | 53 + .../types/devboxes/diagnostic_param.py | 65 + .../diagnostic_related_information_param.py | 17 + .../types/devboxes/diagnostic_severity.py | 7 + .../types/devboxes/diagnostic_tag.py | 7 + .../types/devboxes/diagnostics_response.py | 14 + .../types/devboxes/document_symbol.py | 58 + .../types/devboxes/document_uri.py | 7 + .../types/devboxes/file_contents_response.py | 17 + .../types/devboxes/file_path.py | 7 + .../types/devboxes/file_uri.py | 7 + .../types/devboxes/health_status_response.py | 23 + .../types/devboxes/integer.py | 7 + .../types/devboxes/l_sp_any_param.py | 9 + .../types/devboxes/location_param.py | 33 + .../devboxes/lsp_apply_code_action_params.py | 21 + .../types/devboxes/lsp_code_actions_params.py | 40 + .../types/devboxes/lsp_diagnostics_params.py | 13 + .../devboxes/lsp_document_symbols_params.py | 13 + .../devboxes/lsp_file_definition_params.py | 15 + .../types/devboxes/lsp_file_params.py | 13 + .../types/devboxes/lsp_files_response.py | 10 + .../types/devboxes/lsp_formatting_params.py | 13 + ..._get_code_actions_for_diagnostic_params.py | 15 + ...et_code_actions_for_diagnostic_response.py | 10 + .../lsp_get_code_segment_info_params.py | 19 + .../devboxes/lsp_get_signature_help_params.py | 15 + .../types/devboxes/lsp_references_params.py | 15 + .../lsp_set_watch_directory_params.py | 13 + .../lsp_set_watch_directory_response.py | 7 + .../types/devboxes/position.py | 27 + .../types/devboxes/position_param.py | 29 + .../types/devboxes/range.py | 15 + .../types/devboxes/range_param.py | 17 + .../devboxes/record_string_text_edit_array.py | 10 + .../record_string_text_edit_array_param.py | 12 + .../types/devboxes/signature_help_response.py | 18 + .../types/devboxes/symbol_kind.py | 9 + .../types/devboxes/symbol_tag.py | 7 + .../types/devboxes/symbol_type.py | 7 + .../types/devboxes/text_edit.py | 20 + .../types/devboxes/text_edit_param.py | 21 + src/runloop_api_client/types/devboxes/u_ri.py | 7 + .../types/devboxes/uinteger.py | 7 + .../types/devboxes/watched_file_response.py | 16 + .../types/repository_connection_list_view.py | 17 + .../types/repository_connection_view.py | 25 + .../types/repository_create_params.py | 15 + .../types/repository_list_params.py | 15 + .../types/repository_version_details.py | 44 + .../types/repository_version_list_view.py | 13 + tests/api_resources/devboxes/test_lsp.py | 1607 +++++++++++++++++ tests/api_resources/test_repositories.py | 388 ++++ 81 files changed, 5461 insertions(+), 3 deletions(-) create mode 100644 src/runloop_api_client/resources/devboxes/lsp.py create mode 100644 src/runloop_api_client/resources/repositories.py create mode 100644 src/runloop_api_client/types/devboxes/base_code_action.py create mode 100644 src/runloop_api_client/types/devboxes/base_command.py create mode 100644 src/runloop_api_client/types/devboxes/base_command_param.py create mode 100644 src/runloop_api_client/types/devboxes/base_diagnostic.py create mode 100644 src/runloop_api_client/types/devboxes/base_diagnostic_param.py create mode 100644 src/runloop_api_client/types/devboxes/base_location.py create mode 100644 src/runloop_api_client/types/devboxes/base_markup_content.py create mode 100644 src/runloop_api_client/types/devboxes/base_parameter_information.py create mode 100644 src/runloop_api_client/types/devboxes/base_range.py create mode 100644 src/runloop_api_client/types/devboxes/base_range_param.py create mode 100644 src/runloop_api_client/types/devboxes/base_signature.py create mode 100644 src/runloop_api_client/types/devboxes/base_workspace_edit.py create mode 100644 src/runloop_api_client/types/devboxes/base_workspace_edit_param.py create mode 100644 src/runloop_api_client/types/devboxes/code_action_application_result.py create mode 100644 src/runloop_api_client/types/devboxes/code_action_context_param.py create mode 100644 src/runloop_api_client/types/devboxes/code_action_kind.py create mode 100644 src/runloop_api_client/types/devboxes/code_action_trigger_kind.py create mode 100644 src/runloop_api_client/types/devboxes/code_description_param.py create mode 100644 src/runloop_api_client/types/devboxes/code_segment_info_response.py create mode 100644 src/runloop_api_client/types/devboxes/diagnostic_param.py create mode 100644 src/runloop_api_client/types/devboxes/diagnostic_related_information_param.py create mode 100644 src/runloop_api_client/types/devboxes/diagnostic_severity.py create mode 100644 src/runloop_api_client/types/devboxes/diagnostic_tag.py create mode 100644 src/runloop_api_client/types/devboxes/diagnostics_response.py create mode 100644 src/runloop_api_client/types/devboxes/document_symbol.py create mode 100644 src/runloop_api_client/types/devboxes/document_uri.py create mode 100644 src/runloop_api_client/types/devboxes/file_contents_response.py create mode 100644 src/runloop_api_client/types/devboxes/file_path.py create mode 100644 src/runloop_api_client/types/devboxes/file_uri.py create mode 100644 src/runloop_api_client/types/devboxes/health_status_response.py create mode 100644 src/runloop_api_client/types/devboxes/integer.py create mode 100644 src/runloop_api_client/types/devboxes/l_sp_any_param.py create mode 100644 src/runloop_api_client/types/devboxes/location_param.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_apply_code_action_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_code_actions_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_diagnostics_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_document_symbols_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_file_definition_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_file_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_files_response.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_formatting_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_get_code_actions_for_diagnostic_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_get_code_actions_for_diagnostic_response.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_get_code_segment_info_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_get_signature_help_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_references_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_set_watch_directory_params.py create mode 100644 src/runloop_api_client/types/devboxes/lsp_set_watch_directory_response.py create mode 100644 src/runloop_api_client/types/devboxes/position.py create mode 100644 src/runloop_api_client/types/devboxes/position_param.py create mode 100644 src/runloop_api_client/types/devboxes/range.py create mode 100644 src/runloop_api_client/types/devboxes/range_param.py create mode 100644 src/runloop_api_client/types/devboxes/record_string_text_edit_array.py create mode 100644 src/runloop_api_client/types/devboxes/record_string_text_edit_array_param.py create mode 100644 src/runloop_api_client/types/devboxes/signature_help_response.py create mode 100644 src/runloop_api_client/types/devboxes/symbol_kind.py create mode 100644 src/runloop_api_client/types/devboxes/symbol_tag.py create mode 100644 src/runloop_api_client/types/devboxes/symbol_type.py create mode 100644 src/runloop_api_client/types/devboxes/text_edit.py create mode 100644 src/runloop_api_client/types/devboxes/text_edit_param.py create mode 100644 src/runloop_api_client/types/devboxes/u_ri.py create mode 100644 src/runloop_api_client/types/devboxes/uinteger.py create mode 100644 src/runloop_api_client/types/devboxes/watched_file_response.py create mode 100644 src/runloop_api_client/types/repository_connection_list_view.py create mode 100644 src/runloop_api_client/types/repository_connection_view.py create mode 100644 src/runloop_api_client/types/repository_create_params.py create mode 100644 src/runloop_api_client/types/repository_list_params.py create mode 100644 src/runloop_api_client/types/repository_version_details.py create mode 100644 src/runloop_api_client/types/repository_version_list_view.py create mode 100644 tests/api_resources/devboxes/test_lsp.py create mode 100644 tests/api_resources/test_repositories.py diff --git a/.stats.yml b/.stats.yml index b8bd20ffa..a4863f252 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 33 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-eb0f4c286298e89e0db9188a3f70bd5ef9c3ea84dd26f23c1fe3e9f4498d845e.yml +configured_endpoints: 52 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-8ae2b8efa48447d8566071937b2c38b2efe6440d13340229a8a3f80d71b97ecc.yml diff --git a/api.md b/api.md index 160665026..9c73c5563 100644 --- a/api.md +++ b/api.md @@ -80,6 +80,88 @@ Methods: - client.devboxes.upload_file(id, \*\*params) -> object - client.devboxes.write_file(id, \*\*params) -> DevboxExecutionDetailView +## Lsp + +Types: + +```python +from runloop_api_client.types.devboxes import ( + BaseCodeAction, + BaseCommand, + BaseDiagnostic, + BaseLocation, + BaseMarkupContent, + BaseParameterInformation, + BaseRange, + BaseSignature, + BaseWorkspaceEdit, + CodeActionApplicationResult, + CodeActionContext, + CodeActionKind, + CodeActionsForDiagnosticRequestBody, + CodeActionsRequestBody, + CodeActionsResponse, + CodeActionTriggerKind, + CodeDescription, + CodeSegmentInfoRequestBody, + CodeSegmentInfoResponse, + Diagnostic, + DiagnosticRelatedInformation, + DiagnosticSeverity, + DiagnosticsResponse, + DiagnosticTag, + DocumentSymbol, + DocumentSymbolResponse, + DocumentUri, + FileContentsResponse, + FileDefinitionRequestBody, + FileDefinitionResponse, + FilePath, + FileRequestBody, + FileUri, + FormattingResponse, + HealthStatusResponse, + Integer, + Location, + LSpAny, + Position, + Range, + RecordStringTextEditArray, + ReferencesRequestBody, + ReferencesResponse, + SetWatchDirectoryRequestBody, + SignatureHelpRequestBody, + SignatureHelpResponse, + SymbolKind, + SymbolTag, + SymbolType, + TextEdit, + Uinteger, + URi, + WatchedFileResponse, + LspFilesResponse, + LspGetCodeActionsForDiagnosticResponse, + LspSetWatchDirectoryResponse, +) +``` + +Methods: + +- client.devboxes.lsp.apply_code_action(id, \*\*params) -> CodeActionApplicationResult +- client.devboxes.lsp.code_actions(id, \*\*params) -> object +- client.devboxes.lsp.diagnostics(id, \*\*params) -> DiagnosticsResponse +- client.devboxes.lsp.document_symbols(id, \*\*params) -> object +- client.devboxes.lsp.file(id, \*\*params) -> FileContentsResponse +- client.devboxes.lsp.file_definition(id, \*\*params) -> object +- client.devboxes.lsp.files(id) -> LspFilesResponse +- client.devboxes.lsp.formatting(id, \*\*params) -> object +- client.devboxes.lsp.get_code_actions_for_diagnostic(id, \*\*params) -> LspGetCodeActionsForDiagnosticResponse +- client.devboxes.lsp.get_code_segment_info(id, \*\*params) -> CodeSegmentInfoResponse +- client.devboxes.lsp.get_signature_help(id, \*\*params) -> SignatureHelpResponse +- client.devboxes.lsp.health(id) -> HealthStatusResponse +- client.devboxes.lsp.references(id, \*\*params) -> object +- client.devboxes.lsp.set_watch_directory(id, \*\*params) -> str + ## Logs Types: @@ -101,6 +183,28 @@ Methods: - client.devboxes.executions.execute_sync(id, \*\*params) -> DevboxExecutionDetailView - client.devboxes.executions.kill(execution_id, \*, id) -> DevboxAsyncExecutionDetailView +# Repositories + +Types: + +```python +from runloop_api_client.types import ( + RepositoryConnectionListView, + RepositoryConnectionView, + RepositoryVersionDetails, + RepositoryVersionListView, + RepositoryDeleteResponse, +) +``` + +Methods: + +- client.repositories.create(\*\*params) -> RepositoryConnectionView +- client.repositories.retrieve(id) -> RepositoryConnectionView +- client.repositories.list(\*\*params) -> RepositoryConnectionListView +- client.repositories.delete(id) -> object +- client.repositories.versions(id) -> RepositoryVersionListView + # Functions Types: diff --git a/src/runloop_api_client/_client.py b/src/runloop_api_client/_client.py index fcafda610..2f0f58ab1 100644 --- a/src/runloop_api_client/_client.py +++ b/src/runloop_api_client/_client.py @@ -24,7 +24,7 @@ get_async_library, ) from ._version import __version__ -from .resources import blueprints +from .resources import blueprints, repositories from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import RunloopError, APIStatusError from ._base_client import ( @@ -42,6 +42,7 @@ class Runloop(SyncAPIClient): blueprints: blueprints.BlueprintsResource devboxes: devboxes.DevboxesResource + repositories: repositories.RepositoriesResource functions: functions.FunctionsResource projects: projects.ProjectsResource with_raw_response: RunloopWithRawResponse @@ -103,6 +104,7 @@ def __init__( self.blueprints = blueprints.BlueprintsResource(self) self.devboxes = devboxes.DevboxesResource(self) + self.repositories = repositories.RepositoriesResource(self) self.functions = functions.FunctionsResource(self) self.projects = projects.ProjectsResource(self) self.with_raw_response = RunloopWithRawResponse(self) @@ -216,6 +218,7 @@ def _make_status_error( class AsyncRunloop(AsyncAPIClient): blueprints: blueprints.AsyncBlueprintsResource devboxes: devboxes.AsyncDevboxesResource + repositories: repositories.AsyncRepositoriesResource functions: functions.AsyncFunctionsResource projects: projects.AsyncProjectsResource with_raw_response: AsyncRunloopWithRawResponse @@ -277,6 +280,7 @@ def __init__( self.blueprints = blueprints.AsyncBlueprintsResource(self) self.devboxes = devboxes.AsyncDevboxesResource(self) + self.repositories = repositories.AsyncRepositoriesResource(self) self.functions = functions.AsyncFunctionsResource(self) self.projects = projects.AsyncProjectsResource(self) self.with_raw_response = AsyncRunloopWithRawResponse(self) @@ -391,6 +395,7 @@ class RunloopWithRawResponse: def __init__(self, client: Runloop) -> None: self.blueprints = blueprints.BlueprintsResourceWithRawResponse(client.blueprints) self.devboxes = devboxes.DevboxesResourceWithRawResponse(client.devboxes) + self.repositories = repositories.RepositoriesResourceWithRawResponse(client.repositories) self.functions = functions.FunctionsResourceWithRawResponse(client.functions) self.projects = projects.ProjectsResourceWithRawResponse(client.projects) @@ -399,6 +404,7 @@ class AsyncRunloopWithRawResponse: def __init__(self, client: AsyncRunloop) -> None: self.blueprints = blueprints.AsyncBlueprintsResourceWithRawResponse(client.blueprints) self.devboxes = devboxes.AsyncDevboxesResourceWithRawResponse(client.devboxes) + self.repositories = repositories.AsyncRepositoriesResourceWithRawResponse(client.repositories) self.functions = functions.AsyncFunctionsResourceWithRawResponse(client.functions) self.projects = projects.AsyncProjectsResourceWithRawResponse(client.projects) @@ -407,6 +413,7 @@ class RunloopWithStreamedResponse: def __init__(self, client: Runloop) -> None: self.blueprints = blueprints.BlueprintsResourceWithStreamingResponse(client.blueprints) self.devboxes = devboxes.DevboxesResourceWithStreamingResponse(client.devboxes) + self.repositories = repositories.RepositoriesResourceWithStreamingResponse(client.repositories) self.functions = functions.FunctionsResourceWithStreamingResponse(client.functions) self.projects = projects.ProjectsResourceWithStreamingResponse(client.projects) @@ -415,6 +422,7 @@ class AsyncRunloopWithStreamedResponse: def __init__(self, client: AsyncRunloop) -> None: self.blueprints = blueprints.AsyncBlueprintsResourceWithStreamingResponse(client.blueprints) self.devboxes = devboxes.AsyncDevboxesResourceWithStreamingResponse(client.devboxes) + self.repositories = repositories.AsyncRepositoriesResourceWithStreamingResponse(client.repositories) self.functions = functions.AsyncFunctionsResourceWithStreamingResponse(client.functions) self.projects = projects.AsyncProjectsResourceWithStreamingResponse(client.projects) diff --git a/src/runloop_api_client/resources/__init__.py b/src/runloop_api_client/resources/__init__.py index f36499829..97e83cd8e 100644 --- a/src/runloop_api_client/resources/__init__.py +++ b/src/runloop_api_client/resources/__init__.py @@ -32,6 +32,14 @@ BlueprintsResourceWithStreamingResponse, AsyncBlueprintsResourceWithStreamingResponse, ) +from .repositories import ( + RepositoriesResource, + AsyncRepositoriesResource, + RepositoriesResourceWithRawResponse, + AsyncRepositoriesResourceWithRawResponse, + RepositoriesResourceWithStreamingResponse, + AsyncRepositoriesResourceWithStreamingResponse, +) __all__ = [ "BlueprintsResource", @@ -46,6 +54,12 @@ "AsyncDevboxesResourceWithRawResponse", "DevboxesResourceWithStreamingResponse", "AsyncDevboxesResourceWithStreamingResponse", + "RepositoriesResource", + "AsyncRepositoriesResource", + "RepositoriesResourceWithRawResponse", + "AsyncRepositoriesResourceWithRawResponse", + "RepositoriesResourceWithStreamingResponse", + "AsyncRepositoriesResourceWithStreamingResponse", "FunctionsResource", "AsyncFunctionsResource", "FunctionsResourceWithRawResponse", diff --git a/src/runloop_api_client/resources/devboxes/__init__.py b/src/runloop_api_client/resources/devboxes/__init__.py index ec7c746ac..d5378fb54 100644 --- a/src/runloop_api_client/resources/devboxes/__init__.py +++ b/src/runloop_api_client/resources/devboxes/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .lsp import ( + LspResource, + AsyncLspResource, + LspResourceWithRawResponse, + AsyncLspResourceWithRawResponse, + LspResourceWithStreamingResponse, + AsyncLspResourceWithStreamingResponse, +) from .logs import ( LogsResource, AsyncLogsResource, @@ -26,6 +34,12 @@ ) __all__ = [ + "LspResource", + "AsyncLspResource", + "LspResourceWithRawResponse", + "AsyncLspResourceWithRawResponse", + "LspResourceWithStreamingResponse", + "AsyncLspResourceWithStreamingResponse", "LogsResource", "AsyncLogsResource", "LogsResourceWithRawResponse", diff --git a/src/runloop_api_client/resources/devboxes/devboxes.py b/src/runloop_api_client/resources/devboxes/devboxes.py index 68ace3c32..4edef1ace 100644 --- a/src/runloop_api_client/resources/devboxes/devboxes.py +++ b/src/runloop_api_client/resources/devboxes/devboxes.py @@ -6,6 +6,14 @@ import httpx +from .lsp import ( + LspResource, + AsyncLspResource, + LspResourceWithRawResponse, + AsyncLspResourceWithRawResponse, + LspResourceWithStreamingResponse, + AsyncLspResourceWithStreamingResponse, +) from .logs import ( LogsResource, AsyncLogsResource, @@ -74,6 +82,10 @@ class DevboxesResource(SyncAPIResource): + @cached_property + def lsp(self) -> LspResource: + return LspResource(self._client) + @cached_property def logs(self) -> LogsResource: return LogsResource(self._client) @@ -834,6 +846,10 @@ def write_file( class AsyncDevboxesResource(AsyncAPIResource): + @cached_property + def lsp(self) -> AsyncLspResource: + return AsyncLspResource(self._client) + @cached_property def logs(self) -> AsyncLogsResource: return AsyncLogsResource(self._client) @@ -1650,6 +1666,10 @@ def __init__(self, devboxes: DevboxesResource) -> None: devboxes.write_file, ) + @cached_property + def lsp(self) -> LspResourceWithRawResponse: + return LspResourceWithRawResponse(self._devboxes.lsp) + @cached_property def logs(self) -> LogsResourceWithRawResponse: return LogsResourceWithRawResponse(self._devboxes.logs) @@ -1716,6 +1736,10 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: devboxes.write_file, ) + @cached_property + def lsp(self) -> AsyncLspResourceWithRawResponse: + return AsyncLspResourceWithRawResponse(self._devboxes.lsp) + @cached_property def logs(self) -> AsyncLogsResourceWithRawResponse: return AsyncLogsResourceWithRawResponse(self._devboxes.logs) @@ -1782,6 +1806,10 @@ def __init__(self, devboxes: DevboxesResource) -> None: devboxes.write_file, ) + @cached_property + def lsp(self) -> LspResourceWithStreamingResponse: + return LspResourceWithStreamingResponse(self._devboxes.lsp) + @cached_property def logs(self) -> LogsResourceWithStreamingResponse: return LogsResourceWithStreamingResponse(self._devboxes.logs) @@ -1848,6 +1876,10 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: devboxes.write_file, ) + @cached_property + def lsp(self) -> AsyncLspResourceWithStreamingResponse: + return AsyncLspResourceWithStreamingResponse(self._devboxes.lsp) + @cached_property def logs(self) -> AsyncLogsResourceWithStreamingResponse: return AsyncLogsResourceWithStreamingResponse(self._devboxes.logs) diff --git a/src/runloop_api_client/resources/devboxes/lsp.py b/src/runloop_api_client/resources/devboxes/lsp.py new file mode 100644 index 000000000..7d0c9fe4d --- /dev/null +++ b/src/runloop_api_client/resources/devboxes/lsp.py @@ -0,0 +1,1461 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 ..._base_client import make_request_options +from ...types.devboxes import ( + FileUri, + FilePath, + SymbolType, + lsp_file_params, + lsp_formatting_params, + lsp_references_params, + lsp_diagnostics_params, + lsp_code_actions_params, + lsp_file_definition_params, + lsp_document_symbols_params, + lsp_apply_code_action_params, + lsp_get_signature_help_params, + lsp_set_watch_directory_params, + lsp_get_code_segment_info_params, + lsp_get_code_actions_for_diagnostic_params, +) +from ...types.devboxes.file_uri import FileUri +from ...types.devboxes.file_path import FilePath +from ...types.devboxes.range_param import RangeParam +from ...types.devboxes.symbol_type import SymbolType +from ...types.devboxes.base_command_param import BaseCommandParam +from ...types.devboxes.lsp_files_response import LspFilesResponse +from ...types.devboxes.diagnostics_response import DiagnosticsResponse +from ...types.devboxes.base_diagnostic_param import BaseDiagnosticParam +from ...types.devboxes.file_contents_response import FileContentsResponse +from ...types.devboxes.health_status_response import HealthStatusResponse +from ...types.devboxes.signature_help_response import SignatureHelpResponse +from ...types.devboxes.base_workspace_edit_param import BaseWorkspaceEditParam +from ...types.devboxes.code_action_context_param import CodeActionContextParam +from ...types.devboxes.code_segment_info_response import CodeSegmentInfoResponse +from ...types.devboxes.code_action_application_result import CodeActionApplicationResult +from ...types.devboxes.lsp_get_code_actions_for_diagnostic_response import LspGetCodeActionsForDiagnosticResponse + +__all__ = ["LspResource", "AsyncLspResource"] + + +class LspResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> LspResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers + """ + return LspResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LspResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response + """ + return LspResourceWithStreamingResponse(self) + + def apply_code_action( + self, + id: str, + *, + title: str, + command: BaseCommandParam | NotGiven = NOT_GIVEN, + edit: BaseWorkspaceEditParam | NotGiven = NOT_GIVEN, + is_preferred: bool | NotGiven = NOT_GIVEN, + # 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, + ) -> CodeActionApplicationResult: + """ + Apply a code action to a given code segment not all code actions are supported + yet + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/apply-code-action", + body=maybe_transform( + { + "title": title, + "command": command, + "edit": edit, + "is_preferred": is_preferred, + }, + lsp_apply_code_action_params.LspApplyCodeActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CodeActionApplicationResult, + ) + + def code_actions( + self, + id: str, + *, + uri: str, + context: CodeActionContextParam | NotGiven = NOT_GIVEN, + range: RangeParam | NotGiven = NOT_GIVEN, + # 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: + """Get code actions for a part of a document. + + This method calls the + `getCodeActions` method of the `LanguageService` class, which in turn + communicates with the TypeScript language server to retrieve code actions for a + given document. + https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction + + Args: + context: Contains additional diagnostic information about the context in which a {@link + CodeActionProvider.provideCodeActions code action} is run. The CodeActionContext + namespace provides helper functions to work with {@link CodeActionContext} + literals. + + range: A range in a text document expressed as (zero-based) start and end positions. + + If you want to specify a range that contains a line including the line ending + character(s) then use an end position denoting the start of the next line. For + example: + + ```ts + { + start: { line: 5, character: 23 } + end : { line 6, character : 0 } + } + ``` + + The Range namespace provides helper functions to work with {@link Range} + literals. + + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/code-actions", + body=maybe_transform( + { + "uri": uri, + "context": context, + "range": range, + }, + lsp_code_actions_params.LspCodeActionsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def diagnostics( + self, + id: str, + *, + uri: FileUri, + # 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, + ) -> DiagnosticsResponse: + """ + Get diagnostics for a given file URI from the language server + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/diagnostics", + body=maybe_transform({"uri": uri}, lsp_diagnostics_params.LspDiagnosticsParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DiagnosticsResponse, + ) + + def document_symbols( + self, + id: str, + *, + uri: FileUri, + # 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: + """ + Get document symbols for a given document. + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/document-symbols", + body=maybe_transform({"uri": uri}, lsp_document_symbols_params.LspDocumentSymbolsParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def file( + self, + id: str, + *, + path: FilePath, + # 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, + ) -> FileContentsResponse: + """ + Get the contents of a file at a given path relative to the root directory + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/file", + body=maybe_transform({"path": path}, lsp_file_params.LspFileParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileContentsResponse, + ) + + def file_definition( + self, + id: str, + *, + character: float, + line: float, + uri: 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: + """ + Get the definition of a symbol at a given position in a file + https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/file-definition", + body=maybe_transform( + { + "character": character, + "line": line, + "uri": uri, + }, + lsp_file_definition_params.LspFileDefinitionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def files( + self, + 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, + ) -> LspFilesResponse: + """ + Get a list of all files being watched by the language server + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._get( + f"/v1/devboxes/{id}/lsp/files", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LspFilesResponse, + ) + + def formatting( + self, + id: str, + *, + uri: FileUri, + # 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: + """ + Get formatting changes for a given document. + https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/formatting", + body=maybe_transform({"uri": uri}, lsp_formatting_params.LspFormattingParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def get_code_actions_for_diagnostic( + self, + id: str, + *, + diagnostic: BaseDiagnosticParam, + uri: 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, + ) -> LspGetCodeActionsForDiagnosticResponse: + """ + Get a list of code actions for a given diagnostic + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/get-code-actions-for-diagnostic", + body=maybe_transform( + { + "diagnostic": diagnostic, + "uri": uri, + }, + lsp_get_code_actions_for_diagnostic_params.LspGetCodeActionsForDiagnosticParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LspGetCodeActionsForDiagnosticResponse, + ) + + def get_code_segment_info( + self, + id: str, + *, + symbol_name: str, + uri: FileUri, + symbol_type: SymbolType | NotGiven = NOT_GIVEN, + # 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, + ) -> CodeSegmentInfoResponse: + """ + Get the symbol, reference, and diagnostic information for a given code segment + in a file at a given depth + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/get-code-segment-info", + body=maybe_transform( + { + "symbol_name": symbol_name, + "uri": uri, + "symbol_type": symbol_type, + }, + lsp_get_code_segment_info_params.LspGetCodeSegmentInfoParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CodeSegmentInfoResponse, + ) + + def get_signature_help( + self, + id: str, + *, + character: float, + line: float, + uri: 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, + ) -> SignatureHelpResponse: + """ + Get the symbol, reference, and diagnostic information for a given code segment + in a file at a given depth + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/get-signature-help", + body=maybe_transform( + { + "character": character, + "line": line, + "uri": uri, + }, + lsp_get_signature_help_params.LspGetSignatureHelpParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SignatureHelpResponse, + ) + + def health( + self, + 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, + ) -> HealthStatusResponse: + """ + This method provides a health check for the language server, including its + status, uptime, the directory being watched, and the name of the module. + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._get( + f"/v1/devboxes/{id}/lsp/health", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=HealthStatusResponse, + ) + + def references( + self, + id: str, + *, + character: float, + line: float, + uri: 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: + """Get references for a given symbol. + + This method calls the `getReferences` method + of the `LanguageService` class, which in turn communicates with the TypeScript + language server to retrieve references for a given symbol in the document. + https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/references", + body=maybe_transform( + { + "character": character, + "line": line, + "uri": uri, + }, + lsp_references_params.LspReferencesParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def set_watch_directory( + self, + id: str, + *, + path: FilePath, + # 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, + ) -> str: + """ + Set the watch directory for the language server to a new path and restart the + server + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/lsp/set-watch-directory", + body=maybe_transform({"path": path}, lsp_set_watch_directory_params.LspSetWatchDirectoryParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=str, + ) + + +class AsyncLspResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncLspResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers + """ + return AsyncLspResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLspResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response + """ + return AsyncLspResourceWithStreamingResponse(self) + + async def apply_code_action( + self, + id: str, + *, + title: str, + command: BaseCommandParam | NotGiven = NOT_GIVEN, + edit: BaseWorkspaceEditParam | NotGiven = NOT_GIVEN, + is_preferred: bool | NotGiven = NOT_GIVEN, + # 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, + ) -> CodeActionApplicationResult: + """ + Apply a code action to a given code segment not all code actions are supported + yet + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/apply-code-action", + body=await async_maybe_transform( + { + "title": title, + "command": command, + "edit": edit, + "is_preferred": is_preferred, + }, + lsp_apply_code_action_params.LspApplyCodeActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CodeActionApplicationResult, + ) + + async def code_actions( + self, + id: str, + *, + uri: str, + context: CodeActionContextParam | NotGiven = NOT_GIVEN, + range: RangeParam | NotGiven = NOT_GIVEN, + # 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: + """Get code actions for a part of a document. + + This method calls the + `getCodeActions` method of the `LanguageService` class, which in turn + communicates with the TypeScript language server to retrieve code actions for a + given document. + https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction + + Args: + context: Contains additional diagnostic information about the context in which a {@link + CodeActionProvider.provideCodeActions code action} is run. The CodeActionContext + namespace provides helper functions to work with {@link CodeActionContext} + literals. + + range: A range in a text document expressed as (zero-based) start and end positions. + + If you want to specify a range that contains a line including the line ending + character(s) then use an end position denoting the start of the next line. For + example: + + ```ts + { + start: { line: 5, character: 23 } + end : { line 6, character : 0 } + } + ``` + + The Range namespace provides helper functions to work with {@link Range} + literals. + + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/code-actions", + body=await async_maybe_transform( + { + "uri": uri, + "context": context, + "range": range, + }, + lsp_code_actions_params.LspCodeActionsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def diagnostics( + self, + id: str, + *, + uri: FileUri, + # 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, + ) -> DiagnosticsResponse: + """ + Get diagnostics for a given file URI from the language server + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/diagnostics", + body=await async_maybe_transform({"uri": uri}, lsp_diagnostics_params.LspDiagnosticsParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DiagnosticsResponse, + ) + + async def document_symbols( + self, + id: str, + *, + uri: FileUri, + # 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: + """ + Get document symbols for a given document. + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/document-symbols", + body=await async_maybe_transform({"uri": uri}, lsp_document_symbols_params.LspDocumentSymbolsParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def file( + self, + id: str, + *, + path: FilePath, + # 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, + ) -> FileContentsResponse: + """ + Get the contents of a file at a given path relative to the root directory + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/file", + body=await async_maybe_transform({"path": path}, lsp_file_params.LspFileParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileContentsResponse, + ) + + async def file_definition( + self, + id: str, + *, + character: float, + line: float, + uri: 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: + """ + Get the definition of a symbol at a given position in a file + https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/file-definition", + body=await async_maybe_transform( + { + "character": character, + "line": line, + "uri": uri, + }, + lsp_file_definition_params.LspFileDefinitionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def files( + self, + 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, + ) -> LspFilesResponse: + """ + Get a list of all files being watched by the language server + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._get( + f"/v1/devboxes/{id}/lsp/files", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LspFilesResponse, + ) + + async def formatting( + self, + id: str, + *, + uri: FileUri, + # 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: + """ + Get formatting changes for a given document. + https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/formatting", + body=await async_maybe_transform({"uri": uri}, lsp_formatting_params.LspFormattingParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def get_code_actions_for_diagnostic( + self, + id: str, + *, + diagnostic: BaseDiagnosticParam, + uri: 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, + ) -> LspGetCodeActionsForDiagnosticResponse: + """ + Get a list of code actions for a given diagnostic + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/get-code-actions-for-diagnostic", + body=await async_maybe_transform( + { + "diagnostic": diagnostic, + "uri": uri, + }, + lsp_get_code_actions_for_diagnostic_params.LspGetCodeActionsForDiagnosticParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LspGetCodeActionsForDiagnosticResponse, + ) + + async def get_code_segment_info( + self, + id: str, + *, + symbol_name: str, + uri: FileUri, + symbol_type: SymbolType | NotGiven = NOT_GIVEN, + # 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, + ) -> CodeSegmentInfoResponse: + """ + Get the symbol, reference, and diagnostic information for a given code segment + in a file at a given depth + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/get-code-segment-info", + body=await async_maybe_transform( + { + "symbol_name": symbol_name, + "uri": uri, + "symbol_type": symbol_type, + }, + lsp_get_code_segment_info_params.LspGetCodeSegmentInfoParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CodeSegmentInfoResponse, + ) + + async def get_signature_help( + self, + id: str, + *, + character: float, + line: float, + uri: 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, + ) -> SignatureHelpResponse: + """ + Get the symbol, reference, and diagnostic information for a given code segment + in a file at a given depth + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/get-signature-help", + body=await async_maybe_transform( + { + "character": character, + "line": line, + "uri": uri, + }, + lsp_get_signature_help_params.LspGetSignatureHelpParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SignatureHelpResponse, + ) + + async def health( + self, + 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, + ) -> HealthStatusResponse: + """ + This method provides a health check for the language server, including its + status, uptime, the directory being watched, and the name of the module. + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._get( + f"/v1/devboxes/{id}/lsp/health", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=HealthStatusResponse, + ) + + async def references( + self, + id: str, + *, + character: float, + line: float, + uri: 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: + """Get references for a given symbol. + + This method calls the `getReferences` method + of the `LanguageService` class, which in turn communicates with the TypeScript + language server to retrieve references for a given symbol in the document. + https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/references", + body=await async_maybe_transform( + { + "character": character, + "line": line, + "uri": uri, + }, + lsp_references_params.LspReferencesParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def set_watch_directory( + self, + id: str, + *, + path: FilePath, + # 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, + ) -> str: + """ + Set the watch directory for the language server to a new path and restart the + server + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/lsp/set-watch-directory", + body=await async_maybe_transform({"path": path}, lsp_set_watch_directory_params.LspSetWatchDirectoryParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=str, + ) + + +class LspResourceWithRawResponse: + def __init__(self, lsp: LspResource) -> None: + self._lsp = lsp + + self.apply_code_action = to_raw_response_wrapper( + lsp.apply_code_action, + ) + self.code_actions = to_raw_response_wrapper( + lsp.code_actions, + ) + self.diagnostics = to_raw_response_wrapper( + lsp.diagnostics, + ) + self.document_symbols = to_raw_response_wrapper( + lsp.document_symbols, + ) + self.file = to_raw_response_wrapper( + lsp.file, + ) + self.file_definition = to_raw_response_wrapper( + lsp.file_definition, + ) + self.files = to_raw_response_wrapper( + lsp.files, + ) + self.formatting = to_raw_response_wrapper( + lsp.formatting, + ) + self.get_code_actions_for_diagnostic = to_raw_response_wrapper( + lsp.get_code_actions_for_diagnostic, + ) + self.get_code_segment_info = to_raw_response_wrapper( + lsp.get_code_segment_info, + ) + self.get_signature_help = to_raw_response_wrapper( + lsp.get_signature_help, + ) + self.health = to_raw_response_wrapper( + lsp.health, + ) + self.references = to_raw_response_wrapper( + lsp.references, + ) + self.set_watch_directory = to_raw_response_wrapper( + lsp.set_watch_directory, + ) + + +class AsyncLspResourceWithRawResponse: + def __init__(self, lsp: AsyncLspResource) -> None: + self._lsp = lsp + + self.apply_code_action = async_to_raw_response_wrapper( + lsp.apply_code_action, + ) + self.code_actions = async_to_raw_response_wrapper( + lsp.code_actions, + ) + self.diagnostics = async_to_raw_response_wrapper( + lsp.diagnostics, + ) + self.document_symbols = async_to_raw_response_wrapper( + lsp.document_symbols, + ) + self.file = async_to_raw_response_wrapper( + lsp.file, + ) + self.file_definition = async_to_raw_response_wrapper( + lsp.file_definition, + ) + self.files = async_to_raw_response_wrapper( + lsp.files, + ) + self.formatting = async_to_raw_response_wrapper( + lsp.formatting, + ) + self.get_code_actions_for_diagnostic = async_to_raw_response_wrapper( + lsp.get_code_actions_for_diagnostic, + ) + self.get_code_segment_info = async_to_raw_response_wrapper( + lsp.get_code_segment_info, + ) + self.get_signature_help = async_to_raw_response_wrapper( + lsp.get_signature_help, + ) + self.health = async_to_raw_response_wrapper( + lsp.health, + ) + self.references = async_to_raw_response_wrapper( + lsp.references, + ) + self.set_watch_directory = async_to_raw_response_wrapper( + lsp.set_watch_directory, + ) + + +class LspResourceWithStreamingResponse: + def __init__(self, lsp: LspResource) -> None: + self._lsp = lsp + + self.apply_code_action = to_streamed_response_wrapper( + lsp.apply_code_action, + ) + self.code_actions = to_streamed_response_wrapper( + lsp.code_actions, + ) + self.diagnostics = to_streamed_response_wrapper( + lsp.diagnostics, + ) + self.document_symbols = to_streamed_response_wrapper( + lsp.document_symbols, + ) + self.file = to_streamed_response_wrapper( + lsp.file, + ) + self.file_definition = to_streamed_response_wrapper( + lsp.file_definition, + ) + self.files = to_streamed_response_wrapper( + lsp.files, + ) + self.formatting = to_streamed_response_wrapper( + lsp.formatting, + ) + self.get_code_actions_for_diagnostic = to_streamed_response_wrapper( + lsp.get_code_actions_for_diagnostic, + ) + self.get_code_segment_info = to_streamed_response_wrapper( + lsp.get_code_segment_info, + ) + self.get_signature_help = to_streamed_response_wrapper( + lsp.get_signature_help, + ) + self.health = to_streamed_response_wrapper( + lsp.health, + ) + self.references = to_streamed_response_wrapper( + lsp.references, + ) + self.set_watch_directory = to_streamed_response_wrapper( + lsp.set_watch_directory, + ) + + +class AsyncLspResourceWithStreamingResponse: + def __init__(self, lsp: AsyncLspResource) -> None: + self._lsp = lsp + + self.apply_code_action = async_to_streamed_response_wrapper( + lsp.apply_code_action, + ) + self.code_actions = async_to_streamed_response_wrapper( + lsp.code_actions, + ) + self.diagnostics = async_to_streamed_response_wrapper( + lsp.diagnostics, + ) + self.document_symbols = async_to_streamed_response_wrapper( + lsp.document_symbols, + ) + self.file = async_to_streamed_response_wrapper( + lsp.file, + ) + self.file_definition = async_to_streamed_response_wrapper( + lsp.file_definition, + ) + self.files = async_to_streamed_response_wrapper( + lsp.files, + ) + self.formatting = async_to_streamed_response_wrapper( + lsp.formatting, + ) + self.get_code_actions_for_diagnostic = async_to_streamed_response_wrapper( + lsp.get_code_actions_for_diagnostic, + ) + self.get_code_segment_info = async_to_streamed_response_wrapper( + lsp.get_code_segment_info, + ) + self.get_signature_help = async_to_streamed_response_wrapper( + lsp.get_signature_help, + ) + self.health = async_to_streamed_response_wrapper( + lsp.health, + ) + self.references = async_to_streamed_response_wrapper( + lsp.references, + ) + self.set_watch_directory = async_to_streamed_response_wrapper( + lsp.set_watch_directory, + ) diff --git a/src/runloop_api_client/resources/repositories.py b/src/runloop_api_client/resources/repositories.py new file mode 100644 index 000000000..7c54adecb --- /dev/null +++ b/src/runloop_api_client/resources/repositories.py @@ -0,0 +1,528 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import repository_list_params, repository_create_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 .._base_client import make_request_options +from ..types.repository_connection_view import RepositoryConnectionView +from ..types.repository_version_list_view import RepositoryVersionListView +from ..types.repository_connection_list_view import RepositoryConnectionListView + +__all__ = ["RepositoriesResource", "AsyncRepositoriesResource"] + + +class RepositoriesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RepositoriesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers + """ + return RepositoriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RepositoriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response + """ + return RepositoriesResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + owner: 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, + ) -> RepositoryConnectionView: + """ + Create a connection a Repository with the specified configuration. + + Args: + name: Name of the repository. + + owner: Account owner of the repository. + + 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( + "/v1/repositories", + body=maybe_transform( + { + "name": name, + "owner": owner, + }, + repository_create_params.RepositoryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RepositoryConnectionView, + ) + + def retrieve( + self, + 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, + ) -> RepositoryConnectionView: + """ + Get repository connection details. + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._get( + f"/v1/repositories/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RepositoryConnectionView, + ) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + starting_after: str | NotGiven = NOT_GIVEN, + # 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, + ) -> RepositoryConnectionListView: + """ + List all available repository connections. + + Args: + limit: Page Limit + + starting_after: Load the next page starting after the given token. + + 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._get( + "/v1/repositories", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "starting_after": starting_after, + }, + repository_list_params.RepositoryListParams, + ), + ), + cast_to=RepositoryConnectionListView, + ) + + def delete( + self, + 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: + """ + Delete a repository connection. + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/repositories/{id}/delete", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def versions( + self, + 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, + ) -> RepositoryVersionListView: + """ + List all analyzed versions of a repository connection. + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._get( + f"/v1/repositories/{id}/versions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RepositoryVersionListView, + ) + + +class AsyncRepositoriesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRepositoriesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers + """ + return AsyncRepositoriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRepositoriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response + """ + return AsyncRepositoriesResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + owner: 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, + ) -> RepositoryConnectionView: + """ + Create a connection a Repository with the specified configuration. + + Args: + name: Name of the repository. + + owner: Account owner of the repository. + + 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( + "/v1/repositories", + body=await async_maybe_transform( + { + "name": name, + "owner": owner, + }, + repository_create_params.RepositoryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RepositoryConnectionView, + ) + + async def retrieve( + self, + 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, + ) -> RepositoryConnectionView: + """ + Get repository connection details. + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._get( + f"/v1/repositories/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RepositoryConnectionView, + ) + + async def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + starting_after: str | NotGiven = NOT_GIVEN, + # 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, + ) -> RepositoryConnectionListView: + """ + List all available repository connections. + + Args: + limit: Page Limit + + starting_after: Load the next page starting after the given token. + + 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._get( + "/v1/repositories", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "limit": limit, + "starting_after": starting_after, + }, + repository_list_params.RepositoryListParams, + ), + ), + cast_to=RepositoryConnectionListView, + ) + + async def delete( + self, + 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: + """ + Delete a repository connection. + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/repositories/{id}/delete", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def versions( + self, + 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, + ) -> RepositoryVersionListView: + """ + List all analyzed versions of a repository connection. + + Args: + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._get( + f"/v1/repositories/{id}/versions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RepositoryVersionListView, + ) + + +class RepositoriesResourceWithRawResponse: + def __init__(self, repositories: RepositoriesResource) -> None: + self._repositories = repositories + + self.create = to_raw_response_wrapper( + repositories.create, + ) + self.retrieve = to_raw_response_wrapper( + repositories.retrieve, + ) + self.list = to_raw_response_wrapper( + repositories.list, + ) + self.delete = to_raw_response_wrapper( + repositories.delete, + ) + self.versions = to_raw_response_wrapper( + repositories.versions, + ) + + +class AsyncRepositoriesResourceWithRawResponse: + def __init__(self, repositories: AsyncRepositoriesResource) -> None: + self._repositories = repositories + + self.create = async_to_raw_response_wrapper( + repositories.create, + ) + self.retrieve = async_to_raw_response_wrapper( + repositories.retrieve, + ) + self.list = async_to_raw_response_wrapper( + repositories.list, + ) + self.delete = async_to_raw_response_wrapper( + repositories.delete, + ) + self.versions = async_to_raw_response_wrapper( + repositories.versions, + ) + + +class RepositoriesResourceWithStreamingResponse: + def __init__(self, repositories: RepositoriesResource) -> None: + self._repositories = repositories + + self.create = to_streamed_response_wrapper( + repositories.create, + ) + self.retrieve = to_streamed_response_wrapper( + repositories.retrieve, + ) + self.list = to_streamed_response_wrapper( + repositories.list, + ) + self.delete = to_streamed_response_wrapper( + repositories.delete, + ) + self.versions = to_streamed_response_wrapper( + repositories.versions, + ) + + +class AsyncRepositoriesResourceWithStreamingResponse: + def __init__(self, repositories: AsyncRepositoriesResource) -> None: + self._repositories = repositories + + self.create = async_to_streamed_response_wrapper( + repositories.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + repositories.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + repositories.list, + ) + self.delete = async_to_streamed_response_wrapper( + repositories.delete, + ) + self.versions = async_to_streamed_response_wrapper( + repositories.versions, + ) diff --git a/src/runloop_api_client/types/__init__.py b/src/runloop_api_client/types/__init__.py index 1f6ecb59b..77d09aa94 100644 --- a/src/runloop_api_client/types/__init__.py +++ b/src/runloop_api_client/types/__init__.py @@ -22,13 +22,17 @@ from .blueprint_list_params import BlueprintListParams as BlueprintListParams from .code_mount_parameters import CodeMountParameters as CodeMountParameters from .blueprint_preview_view import BlueprintPreviewView as BlueprintPreviewView +from .repository_list_params import RepositoryListParams as RepositoryListParams from .blueprint_create_params import BlueprintCreateParams as BlueprintCreateParams from .blueprint_preview_params import BlueprintPreviewParams as BlueprintPreviewParams from .devbox_write_file_params import DevboxWriteFileParams as DevboxWriteFileParams +from .repository_create_params import RepositoryCreateParams as RepositoryCreateParams from .devbox_snapshot_list_view import DevboxSnapshotListView as DevboxSnapshotListView from .devbox_upload_file_params import DevboxUploadFileParams as DevboxUploadFileParams from .blueprint_build_parameters import BlueprintBuildParameters as BlueprintBuildParameters from .devbox_execute_sync_params import DevboxExecuteSyncParams as DevboxExecuteSyncParams +from .repository_connection_view import RepositoryConnectionView as RepositoryConnectionView +from .repository_version_details import RepositoryVersionDetails as RepositoryVersionDetails from .code_mount_parameters_param import CodeMountParametersParam as CodeMountParametersParam from .devbox_create_tunnel_params import DevboxCreateTunnelParams as DevboxCreateTunnelParams from .devbox_download_file_params import DevboxDownloadFileParams as DevboxDownloadFileParams @@ -38,8 +42,10 @@ from .devbox_disk_snapshots_params import DevboxDiskSnapshotsParams as DevboxDiskSnapshotsParams from .devbox_execution_detail_view import DevboxExecutionDetailView as DevboxExecutionDetailView from .function_invoke_async_params import FunctionInvokeAsyncParams as FunctionInvokeAsyncParams +from .repository_version_list_view import RepositoryVersionListView as RepositoryVersionListView from .blueprint_build_logs_list_view import BlueprintBuildLogsListView as BlueprintBuildLogsListView from .devbox_create_ssh_key_response import DevboxCreateSSHKeyResponse as DevboxCreateSSHKeyResponse +from .repository_connection_list_view import RepositoryConnectionListView as RepositoryConnectionListView from .devbox_read_file_contents_params import DevboxReadFileContentsParams as DevboxReadFileContentsParams from .devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView as DevboxAsyncExecutionDetailView from .devbox_read_file_contents_response import DevboxReadFileContentsResponse as DevboxReadFileContentsResponse diff --git a/src/runloop_api_client/types/devboxes/__init__.py b/src/runloop_api_client/types/devboxes/__init__.py index 809acc5e1..30d13b0fb 100644 --- a/src/runloop_api_client/types/devboxes/__init__.py +++ b/src/runloop_api_client/types/devboxes/__init__.py @@ -2,8 +2,75 @@ from __future__ import annotations +from .u_ri import URi as URi +from .range import Range as Range +from .integer import Integer as Integer +from .file_uri import FileUri as FileUri +from .position import Position as Position +from .uinteger import Uinteger as Uinteger +from .file_path import FilePath as FilePath +from .text_edit import TextEdit as TextEdit +from .base_range import BaseRange as BaseRange +from .symbol_tag import SymbolTag as SymbolTag +from .range_param import RangeParam as RangeParam +from .symbol_kind import SymbolKind as SymbolKind +from .symbol_type import SymbolType as SymbolType +from .base_command import BaseCommand as BaseCommand +from .document_uri import DocumentUri as DocumentUri +from .base_location import BaseLocation as BaseLocation +from .base_signature import BaseSignature as BaseSignature +from .diagnostic_tag import DiagnosticTag as DiagnosticTag +from .l_sp_any_param import LSpAnyParam as LSpAnyParam +from .location_param import LocationParam as LocationParam +from .position_param import PositionParam as PositionParam +from .base_diagnostic import BaseDiagnostic as BaseDiagnostic +from .document_symbol import DocumentSymbol as DocumentSymbol from .log_list_params import LogListParams as LogListParams +from .lsp_file_params import LspFileParams as LspFileParams +from .text_edit_param import TextEditParam as TextEditParam +from .base_code_action import BaseCodeAction as BaseCodeAction +from .base_range_param import BaseRangeParam as BaseRangeParam +from .code_action_kind import CodeActionKind as CodeActionKind +from .diagnostic_param import DiagnosticParam as DiagnosticParam +from .base_command_param import BaseCommandParam as BaseCommandParam +from .lsp_files_response import LspFilesResponse as LspFilesResponse +from .base_markup_content import BaseMarkupContent as BaseMarkupContent +from .base_workspace_edit import BaseWorkspaceEdit as BaseWorkspaceEdit +from .diagnostic_severity import DiagnosticSeverity as DiagnosticSeverity +from .diagnostics_response import DiagnosticsResponse as DiagnosticsResponse +from .base_diagnostic_param import BaseDiagnosticParam as BaseDiagnosticParam from .devbox_logs_list_view import DevboxLogsListView as DevboxLogsListView +from .lsp_formatting_params import LspFormattingParams as LspFormattingParams +from .lsp_references_params import LspReferencesParams as LspReferencesParams +from .watched_file_response import WatchedFileResponse as WatchedFileResponse +from .code_description_param import CodeDescriptionParam as CodeDescriptionParam +from .file_contents_response import FileContentsResponse as FileContentsResponse +from .health_status_response import HealthStatusResponse as HealthStatusResponse +from .lsp_diagnostics_params import LspDiagnosticsParams as LspDiagnosticsParams +from .lsp_code_actions_params import LspCodeActionsParams as LspCodeActionsParams +from .signature_help_response import SignatureHelpResponse as SignatureHelpResponse +from .code_action_trigger_kind import CodeActionTriggerKind as CodeActionTriggerKind +from .base_workspace_edit_param import BaseWorkspaceEditParam as BaseWorkspaceEditParam +from .code_action_context_param import CodeActionContextParam as CodeActionContextParam from .execution_retrieve_params import ExecutionRetrieveParams as ExecutionRetrieveParams +from .base_parameter_information import BaseParameterInformation as BaseParameterInformation +from .code_segment_info_response import CodeSegmentInfoResponse as CodeSegmentInfoResponse +from .lsp_file_definition_params import LspFileDefinitionParams as LspFileDefinitionParams +from .lsp_document_symbols_params import LspDocumentSymbolsParams as LspDocumentSymbolsParams +from .lsp_apply_code_action_params import LspApplyCodeActionParams as LspApplyCodeActionParams from .execution_execute_sync_params import ExecutionExecuteSyncParams as ExecutionExecuteSyncParams +from .lsp_get_signature_help_params import LspGetSignatureHelpParams as LspGetSignatureHelpParams +from .record_string_text_edit_array import RecordStringTextEditArray as RecordStringTextEditArray +from .code_action_application_result import CodeActionApplicationResult as CodeActionApplicationResult from .execution_execute_async_params import ExecutionExecuteAsyncParams as ExecutionExecuteAsyncParams +from .lsp_set_watch_directory_params import LspSetWatchDirectoryParams as LspSetWatchDirectoryParams +from .lsp_get_code_segment_info_params import LspGetCodeSegmentInfoParams as LspGetCodeSegmentInfoParams +from .lsp_set_watch_directory_response import LspSetWatchDirectoryResponse as LspSetWatchDirectoryResponse +from .record_string_text_edit_array_param import RecordStringTextEditArrayParam as RecordStringTextEditArrayParam +from .diagnostic_related_information_param import DiagnosticRelatedInformationParam as DiagnosticRelatedInformationParam +from .lsp_get_code_actions_for_diagnostic_params import ( + LspGetCodeActionsForDiagnosticParams as LspGetCodeActionsForDiagnosticParams, +) +from .lsp_get_code_actions_for_diagnostic_response import ( + LspGetCodeActionsForDiagnosticResponse as LspGetCodeActionsForDiagnosticResponse, +) diff --git a/src/runloop_api_client/types/devboxes/base_code_action.py b/src/runloop_api_client/types/devboxes/base_code_action.py new file mode 100644 index 000000000..d74e9a0f6 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_code_action.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .base_command import BaseCommand +from .base_workspace_edit import BaseWorkspaceEdit + +__all__ = ["BaseCodeAction"] + + +class BaseCodeAction(BaseModel): + title: str + + command: Optional[BaseCommand] = None + + edit: Optional[BaseWorkspaceEdit] = None + + is_preferred: Optional[bool] = FieldInfo(alias="isPreferred", default=None) diff --git a/src/runloop_api_client/types/devboxes/base_command.py b/src/runloop_api_client/types/devboxes/base_command.py new file mode 100644 index 000000000..7defd0e9a --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_command.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["BaseCommand"] + + +class BaseCommand(BaseModel): + command: str + + title: str + + arguments: Optional[List[object]] = None diff --git a/src/runloop_api_client/types/devboxes/base_command_param.py b/src/runloop_api_client/types/devboxes/base_command_param.py new file mode 100644 index 000000000..fe17f38f6 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_command_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["BaseCommandParam"] + + +class BaseCommandParam(TypedDict, total=False): + command: Required[str] + + title: Required[str] + + arguments: Iterable[object] diff --git a/src/runloop_api_client/types/devboxes/base_diagnostic.py b/src/runloop_api_client/types/devboxes/base_diagnostic.py new file mode 100644 index 000000000..83249c034 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_diagnostic.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional + +from ..._models import BaseModel +from .base_range import BaseRange +from .diagnostic_severity import DiagnosticSeverity + +__all__ = ["BaseDiagnostic"] + + +class BaseDiagnostic(BaseModel): + message: str + + range: BaseRange + + code: Union[float, str, None] = None + + severity: Optional[DiagnosticSeverity] = None + """The diagnostic's severity.""" + + source: Optional[str] = None diff --git a/src/runloop_api_client/types/devboxes/base_diagnostic_param.py b/src/runloop_api_client/types/devboxes/base_diagnostic_param.py new file mode 100644 index 000000000..b74f7435e --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_diagnostic_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Required, TypedDict + +from .base_range_param import BaseRangeParam +from .diagnostic_severity import DiagnosticSeverity + +__all__ = ["BaseDiagnosticParam"] + + +class BaseDiagnosticParam(TypedDict, total=False): + message: Required[str] + + range: Required[BaseRangeParam] + + code: Union[float, str] + + severity: DiagnosticSeverity + """The diagnostic's severity.""" + + source: str diff --git a/src/runloop_api_client/types/devboxes/base_location.py b/src/runloop_api_client/types/devboxes/base_location.py new file mode 100644 index 000000000..3d83663f0 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_location.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel +from .base_range import BaseRange + +__all__ = ["BaseLocation"] + + +class BaseLocation(BaseModel): + range: BaseRange + + uri: str diff --git a/src/runloop_api_client/types/devboxes/base_markup_content.py b/src/runloop_api_client/types/devboxes/base_markup_content.py new file mode 100644 index 000000000..bd874488d --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_markup_content.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["BaseMarkupContent"] + + +class BaseMarkupContent(BaseModel): + kind: str + + value: str diff --git a/src/runloop_api_client/types/devboxes/base_parameter_information.py b/src/runloop_api_client/types/devboxes/base_parameter_information.py new file mode 100644 index 000000000..0075870f3 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_parameter_information.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel +from .base_markup_content import BaseMarkupContent + +__all__ = ["BaseParameterInformation", "Documentation"] + +Documentation: TypeAlias = Union[str, BaseMarkupContent] + + +class BaseParameterInformation(BaseModel): + label: str + + documentation: Optional[Documentation] = None diff --git a/src/runloop_api_client/types/devboxes/base_range.py b/src/runloop_api_client/types/devboxes/base_range.py new file mode 100644 index 000000000..52e22338d --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_range.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["BaseRange", "End", "Start"] + + +class End(BaseModel): + character: float + + line: float + + +class Start(BaseModel): + character: float + + line: float + + +class BaseRange(BaseModel): + end: End + + start: Start diff --git a/src/runloop_api_client/types/devboxes/base_range_param.py b/src/runloop_api_client/types/devboxes/base_range_param.py new file mode 100644 index 000000000..d97e7fdee --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_range_param.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["BaseRangeParam", "End", "Start"] + + +class End(TypedDict, total=False): + character: Required[float] + + line: Required[float] + + +class Start(TypedDict, total=False): + character: Required[float] + + line: Required[float] + + +class BaseRangeParam(TypedDict, total=False): + end: Required[End] + + start: Required[Start] diff --git a/src/runloop_api_client/types/devboxes/base_signature.py b/src/runloop_api_client/types/devboxes/base_signature.py new file mode 100644 index 000000000..7c1df775f --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_signature.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel +from .base_markup_content import BaseMarkupContent +from .base_parameter_information import BaseParameterInformation + +__all__ = ["BaseSignature", "Documentation"] + +Documentation: TypeAlias = Union[str, BaseMarkupContent] + + +class BaseSignature(BaseModel): + label: str + + documentation: Optional[Documentation] = None + + parameters: Optional[List[BaseParameterInformation]] = None diff --git a/src/runloop_api_client/types/devboxes/base_workspace_edit.py b/src/runloop_api_client/types/devboxes/base_workspace_edit.py new file mode 100644 index 000000000..db5a77fa4 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_workspace_edit.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .record_string_text_edit_array import RecordStringTextEditArray + +__all__ = ["BaseWorkspaceEdit"] + + +class BaseWorkspaceEdit(BaseModel): + changes: Optional[RecordStringTextEditArray] = None + """Construct a type with a set of properties K of type T""" diff --git a/src/runloop_api_client/types/devboxes/base_workspace_edit_param.py b/src/runloop_api_client/types/devboxes/base_workspace_edit_param.py new file mode 100644 index 000000000..89a933497 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/base_workspace_edit_param.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .record_string_text_edit_array_param import RecordStringTextEditArrayParam + +__all__ = ["BaseWorkspaceEditParam"] + + +class BaseWorkspaceEditParam(TypedDict, total=False): + changes: RecordStringTextEditArrayParam + """Construct a type with a set of properties K of type T""" diff --git a/src/runloop_api_client/types/devboxes/code_action_application_result.py b/src/runloop_api_client/types/devboxes/code_action_application_result.py new file mode 100644 index 000000000..49a2ad557 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/code_action_application_result.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["CodeActionApplicationResult"] + + +class CodeActionApplicationResult(BaseModel): + success: bool + + error: Optional[str] = None + + files_changed: Optional[List[str]] = FieldInfo(alias="filesChanged", default=None) diff --git a/src/runloop_api_client/types/devboxes/code_action_context_param.py b/src/runloop_api_client/types/devboxes/code_action_context_param.py new file mode 100644 index 000000000..df6ee765f --- /dev/null +++ b/src/runloop_api_client/types/devboxes/code_action_context_param.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo +from .code_action_kind import CodeActionKind +from .diagnostic_param import DiagnosticParam +from .code_action_trigger_kind import CodeActionTriggerKind + +__all__ = ["CodeActionContextParam"] + + +class CodeActionContextParam(TypedDict, total=False): + diagnostics: Required[Iterable[DiagnosticParam]] + """ + An array of diagnostics known on the client side overlapping the range provided + to the `textDocument/codeAction` request. They are provided so that the server + knows which errors are currently presented to the user for the given range. + There is no guarantee that these accurately reflect the error state of the + resource. The primary parameter to compute code actions is the provided range. + """ + + only: List[CodeActionKind] + """Requested kind of actions to return. + + Actions not of this kind are filtered out by the client before being shown. So + servers can omit computing them. + """ + + trigger_kind: Annotated[CodeActionTriggerKind, PropertyInfo(alias="triggerKind")] + """The reason why code actions were requested.""" diff --git a/src/runloop_api_client/types/devboxes/code_action_kind.py b/src/runloop_api_client/types/devboxes/code_action_kind.py new file mode 100644 index 000000000..2878d6335 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/code_action_kind.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["CodeActionKind"] + +CodeActionKind: TypeAlias = str diff --git a/src/runloop_api_client/types/devboxes/code_action_trigger_kind.py b/src/runloop_api_client/types/devboxes/code_action_trigger_kind.py new file mode 100644 index 000000000..f365d75f8 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/code_action_trigger_kind.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["CodeActionTriggerKind"] + +CodeActionTriggerKind: TypeAlias = Literal[1, 2] diff --git a/src/runloop_api_client/types/devboxes/code_description_param.py b/src/runloop_api_client/types/devboxes/code_description_param.py new file mode 100644 index 000000000..616f4446f --- /dev/null +++ b/src/runloop_api_client/types/devboxes/code_description_param.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .u_ri import URi + +__all__ = ["CodeDescriptionParam"] + + +class CodeDescriptionParam(TypedDict, total=False): + href: Required[URi] + """An URI to open with more information about the diagnostic error.""" diff --git a/src/runloop_api_client/types/devboxes/code_segment_info_response.py b/src/runloop_api_client/types/devboxes/code_segment_info_response.py new file mode 100644 index 000000000..43b4e0a72 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/code_segment_info_response.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional + +from .file_uri import FileUri +from ..._compat import PYDANTIC_V2 +from ..._models import BaseModel +from .base_range import BaseRange +from .base_location import BaseLocation +from .base_diagnostic import BaseDiagnostic +from .document_symbol import DocumentSymbol +from .base_code_action import BaseCodeAction +from .signature_help_response import SignatureHelpResponse + +__all__ = ["CodeSegmentInfoResponse", "Hover"] + + +class Hover(BaseModel): + contents: object + + range: Optional[BaseRange] = None + + +class CodeSegmentInfoResponse(BaseModel): + actions: List[BaseCodeAction] + + diagnostics: List[BaseDiagnostic] + + references: List[BaseLocation] + + symbol: DocumentSymbol + """ + Represents programming constructs like variables, classes, interfaces etc. that + appear in a document. Document symbols can be hierarchical and they have two + ranges: one that encloses its definition and one that points to its most + interesting range, e.g. the range of an identifier. + """ + + uri: FileUri + + hover: Optional[Hover] = None + + signature: Optional[SignatureHelpResponse] = None + + +if PYDANTIC_V2: + CodeSegmentInfoResponse.model_rebuild() + Hover.model_rebuild() +else: + CodeSegmentInfoResponse.update_forward_refs() # type: ignore + Hover.update_forward_refs() # type: ignore diff --git a/src/runloop_api_client/types/devboxes/diagnostic_param.py b/src/runloop_api_client/types/devboxes/diagnostic_param.py new file mode 100644 index 000000000..4ec525ec8 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/diagnostic_param.py @@ -0,0 +1,65 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Required, Annotated, TypedDict + +from .integer import Integer +from ..._utils import PropertyInfo +from .range_param import RangeParam +from .diagnostic_tag import DiagnosticTag +from .l_sp_any_param import LSpAnyParam +from .diagnostic_severity import DiagnosticSeverity +from .code_description_param import CodeDescriptionParam +from .diagnostic_related_information_param import DiagnosticRelatedInformationParam + +__all__ = ["DiagnosticParam"] + + +class DiagnosticParam(TypedDict, total=False): + message: Required[str] + """The diagnostic's message. It usually appears in the user interface""" + + range: Required[RangeParam] + """The range at which the message applies""" + + code: Union[Integer, str] + """The diagnostic's code, which usually appear in the user interface.""" + + code_description: Annotated[CodeDescriptionParam, PropertyInfo(alias="codeDescription")] + """ + An optional property to describe the error code. Requires the code field (above) + to be present/not null. + """ + + data: LSpAnyParam + """ + A data entry field that is preserved between a `textDocument/publishDiagnostics` + notification and `textDocument/codeAction` request. + """ + + related_information: Annotated[ + Iterable[DiagnosticRelatedInformationParam], PropertyInfo(alias="relatedInformation") + ] + """An array of related diagnostic information, e.g. + + when symbol-names within a scope collide all definitions can be marked via this + property. + """ + + severity: DiagnosticSeverity + """The diagnostic's severity. + + Can be omitted. If omitted it is up to the client to interpret diagnostics as + error, warning, info or hint. + """ + + source: str + """A human-readable string describing the source of this diagnostic, e.g. + + 'typescript' or 'super lint'. It usually appears in the user interface. + """ + + tags: Iterable[DiagnosticTag] + """Additional metadata about the diagnostic.""" diff --git a/src/runloop_api_client/types/devboxes/diagnostic_related_information_param.py b/src/runloop_api_client/types/devboxes/diagnostic_related_information_param.py new file mode 100644 index 000000000..9e902d731 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/diagnostic_related_information_param.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .location_param import LocationParam + +__all__ = ["DiagnosticRelatedInformationParam"] + + +class DiagnosticRelatedInformationParam(TypedDict, total=False): + location: Required[LocationParam] + """The location of this related diagnostic information.""" + + message: Required[str] + """The message of this related diagnostic information.""" diff --git a/src/runloop_api_client/types/devboxes/diagnostic_severity.py b/src/runloop_api_client/types/devboxes/diagnostic_severity.py new file mode 100644 index 000000000..34bb1dfe6 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/diagnostic_severity.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["DiagnosticSeverity"] + +DiagnosticSeverity: TypeAlias = Literal[1, 2, 3, 4] diff --git a/src/runloop_api_client/types/devboxes/diagnostic_tag.py b/src/runloop_api_client/types/devboxes/diagnostic_tag.py new file mode 100644 index 000000000..693d4f6e4 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/diagnostic_tag.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["DiagnosticTag"] + +DiagnosticTag: TypeAlias = Literal[1, 2] diff --git a/src/runloop_api_client/types/devboxes/diagnostics_response.py b/src/runloop_api_client/types/devboxes/diagnostics_response.py new file mode 100644 index 000000000..1b75b2741 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/diagnostics_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .base_diagnostic import BaseDiagnostic + +__all__ = ["DiagnosticsResponse"] + + +class DiagnosticsResponse(BaseModel): + diagnostics: List[BaseDiagnostic] + + uri: str diff --git a/src/runloop_api_client/types/devboxes/document_symbol.py b/src/runloop_api_client/types/devboxes/document_symbol.py new file mode 100644 index 000000000..0e58f87ed --- /dev/null +++ b/src/runloop_api_client/types/devboxes/document_symbol.py @@ -0,0 +1,58 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .range import Range +from ..._compat import PYDANTIC_V2 +from ..._models import BaseModel +from .symbol_tag import SymbolTag +from .symbol_kind import SymbolKind + +__all__ = ["DocumentSymbol"] + + +class DocumentSymbol(BaseModel): + kind: SymbolKind + """The kind of this symbol.""" + + name: str + """The name of this symbol. + + Will be displayed in the user interface and therefore must not be an empty + string or a string only consisting of white spaces. + """ + + range: Range + """ + The range enclosing this symbol not including leading/trailing whitespace but + everything else like comments. This information is typically used to determine + if the clients cursor is inside the symbol to reveal in the symbol in the UI. + """ + + selection_range: Range = FieldInfo(alias="selectionRange") + """ + The range that should be selected and revealed when this symbol is being picked, + e.g the name of a function. Must be contained by the `range`. + """ + + children: Optional[List[DocumentSymbol]] = None + """Children of this symbol, e.g. properties of a class.""" + + deprecated: Optional[bool] = None + """Indicates if this symbol is deprecated.""" + + detail: Optional[str] = None + """More detail for this symbol, e.g the signature of a function.""" + + tags: Optional[List[SymbolTag]] = None + """Tags for this document symbol.""" + + +if PYDANTIC_V2: + DocumentSymbol.model_rebuild() +else: + DocumentSymbol.update_forward_refs() # type: ignore diff --git a/src/runloop_api_client/types/devboxes/document_uri.py b/src/runloop_api_client/types/devboxes/document_uri.py new file mode 100644 index 000000000..0b7ae87a3 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/document_uri.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["DocumentUri"] + +DocumentUri: TypeAlias = str diff --git a/src/runloop_api_client/types/devboxes/file_contents_response.py b/src/runloop_api_client/types/devboxes/file_contents_response.py new file mode 100644 index 000000000..e5aa38d11 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/file_contents_response.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .file_path import FilePath + +__all__ = ["FileContentsResponse"] + + +class FileContentsResponse(BaseModel): + contents: str + + full_path: str = FieldInfo(alias="fullPath") + + path: FilePath diff --git a/src/runloop_api_client/types/devboxes/file_path.py b/src/runloop_api_client/types/devboxes/file_path.py new file mode 100644 index 000000000..008c01f66 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/file_path.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["FilePath"] + +FilePath: TypeAlias = str diff --git a/src/runloop_api_client/types/devboxes/file_uri.py b/src/runloop_api_client/types/devboxes/file_uri.py new file mode 100644 index 000000000..293323d00 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/file_uri.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["FileUri"] + +FileUri: TypeAlias = str diff --git a/src/runloop_api_client/types/devboxes/health_status_response.py b/src/runloop_api_client/types/devboxes/health_status_response.py new file mode 100644 index 000000000..5b02dd9af --- /dev/null +++ b/src/runloop_api_client/types/devboxes/health_status_response.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["HealthStatusResponse"] + + +class HealthStatusResponse(BaseModel): + dirty_files: List[str] = FieldInfo(alias="dirtyFiles") + + module_name: str = FieldInfo(alias="moduleName") + + pending_work: Dict[str, object] = FieldInfo(alias="pendingWork") + + status: str + + uptime: str + + watch_directory: str = FieldInfo(alias="watchDirectory") diff --git a/src/runloop_api_client/types/devboxes/integer.py b/src/runloop_api_client/types/devboxes/integer.py new file mode 100644 index 000000000..2ff55a8c7 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/integer.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["Integer"] + +Integer: TypeAlias = float diff --git a/src/runloop_api_client/types/devboxes/l_sp_any_param.py b/src/runloop_api_client/types/devboxes/l_sp_any_param.py new file mode 100644 index 000000000..1fe0adec1 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/l_sp_any_param.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypeAlias + +__all__ = ["LSpAnyParam"] + +LSpAnyParam: TypeAlias = object diff --git a/src/runloop_api_client/types/devboxes/location_param.py b/src/runloop_api_client/types/devboxes/location_param.py new file mode 100644 index 000000000..e2deae54b --- /dev/null +++ b/src/runloop_api_client/types/devboxes/location_param.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .range_param import RangeParam +from .document_uri import DocumentUri + +__all__ = ["LocationParam"] + + +class LocationParam(TypedDict, total=False): + range: Required[RangeParam] + """A range in a text document expressed as (zero-based) start and end positions. + + If you want to specify a range that contains a line including the line ending + character(s) then use an end position denoting the start of the next line. For + example: + + ```ts + { + start: { line: 5, character: 23 } + end : { line 6, character : 0 } + } + ``` + + The Range namespace provides helper functions to work with {@link Range} + literals. + """ + + uri: Required[DocumentUri] + """A tagging type for string properties that are actually document URIs.""" diff --git a/src/runloop_api_client/types/devboxes/lsp_apply_code_action_params.py b/src/runloop_api_client/types/devboxes/lsp_apply_code_action_params.py new file mode 100644 index 000000000..1ab3b23d5 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_apply_code_action_params.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo +from .base_command_param import BaseCommandParam +from .base_workspace_edit_param import BaseWorkspaceEditParam + +__all__ = ["LspApplyCodeActionParams"] + + +class LspApplyCodeActionParams(TypedDict, total=False): + title: Required[str] + + command: BaseCommandParam + + edit: BaseWorkspaceEditParam + + is_preferred: Annotated[bool, PropertyInfo(alias="isPreferred")] diff --git a/src/runloop_api_client/types/devboxes/lsp_code_actions_params.py b/src/runloop_api_client/types/devboxes/lsp_code_actions_params.py new file mode 100644 index 000000000..f59f19457 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_code_actions_params.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .range_param import RangeParam +from .code_action_context_param import CodeActionContextParam + +__all__ = ["LspCodeActionsParams"] + + +class LspCodeActionsParams(TypedDict, total=False): + uri: Required[str] + + context: CodeActionContextParam + """ + Contains additional diagnostic information about the context in which a {@link + CodeActionProvider.provideCodeActions code action} is run. The CodeActionContext + namespace provides helper functions to work with {@link CodeActionContext} + literals. + """ + + range: RangeParam + """A range in a text document expressed as (zero-based) start and end positions. + + If you want to specify a range that contains a line including the line ending + character(s) then use an end position denoting the start of the next line. For + example: + + ```ts + { + start: { line: 5, character: 23 } + end : { line 6, character : 0 } + } + ``` + + The Range namespace provides helper functions to work with {@link Range} + literals. + """ diff --git a/src/runloop_api_client/types/devboxes/lsp_diagnostics_params.py b/src/runloop_api_client/types/devboxes/lsp_diagnostics_params.py new file mode 100644 index 000000000..103f7c1c1 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_diagnostics_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .file_uri import FileUri + +__all__ = ["LspDiagnosticsParams"] + + +class LspDiagnosticsParams(TypedDict, total=False): + uri: Required[FileUri] diff --git a/src/runloop_api_client/types/devboxes/lsp_document_symbols_params.py b/src/runloop_api_client/types/devboxes/lsp_document_symbols_params.py new file mode 100644 index 000000000..f1c85e223 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_document_symbols_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .file_uri import FileUri + +__all__ = ["LspDocumentSymbolsParams"] + + +class LspDocumentSymbolsParams(TypedDict, total=False): + uri: Required[FileUri] diff --git a/src/runloop_api_client/types/devboxes/lsp_file_definition_params.py b/src/runloop_api_client/types/devboxes/lsp_file_definition_params.py new file mode 100644 index 000000000..ea8b647cc --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_file_definition_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LspFileDefinitionParams"] + + +class LspFileDefinitionParams(TypedDict, total=False): + character: Required[float] + + line: Required[float] + + uri: Required[str] diff --git a/src/runloop_api_client/types/devboxes/lsp_file_params.py b/src/runloop_api_client/types/devboxes/lsp_file_params.py new file mode 100644 index 000000000..f3caba3d8 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_file_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .file_path import FilePath + +__all__ = ["LspFileParams"] + + +class LspFileParams(TypedDict, total=False): + path: Required[FilePath] diff --git a/src/runloop_api_client/types/devboxes/lsp_files_response.py b/src/runloop_api_client/types/devboxes/lsp_files_response.py new file mode 100644 index 000000000..699491a0a --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_files_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .watched_file_response import WatchedFileResponse + +__all__ = ["LspFilesResponse"] + +LspFilesResponse: TypeAlias = List[WatchedFileResponse] diff --git a/src/runloop_api_client/types/devboxes/lsp_formatting_params.py b/src/runloop_api_client/types/devboxes/lsp_formatting_params.py new file mode 100644 index 000000000..4ffecaee8 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_formatting_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .file_uri import FileUri + +__all__ = ["LspFormattingParams"] + + +class LspFormattingParams(TypedDict, total=False): + uri: Required[FileUri] diff --git a/src/runloop_api_client/types/devboxes/lsp_get_code_actions_for_diagnostic_params.py b/src/runloop_api_client/types/devboxes/lsp_get_code_actions_for_diagnostic_params.py new file mode 100644 index 000000000..03d24fa27 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_get_code_actions_for_diagnostic_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .base_diagnostic_param import BaseDiagnosticParam + +__all__ = ["LspGetCodeActionsForDiagnosticParams"] + + +class LspGetCodeActionsForDiagnosticParams(TypedDict, total=False): + diagnostic: Required[BaseDiagnosticParam] + + uri: Required[str] diff --git a/src/runloop_api_client/types/devboxes/lsp_get_code_actions_for_diagnostic_response.py b/src/runloop_api_client/types/devboxes/lsp_get_code_actions_for_diagnostic_response.py new file mode 100644 index 000000000..fac1c53a8 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_get_code_actions_for_diagnostic_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .base_code_action import BaseCodeAction + +__all__ = ["LspGetCodeActionsForDiagnosticResponse"] + +LspGetCodeActionsForDiagnosticResponse: TypeAlias = List[BaseCodeAction] diff --git a/src/runloop_api_client/types/devboxes/lsp_get_code_segment_info_params.py b/src/runloop_api_client/types/devboxes/lsp_get_code_segment_info_params.py new file mode 100644 index 000000000..d26cafc31 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_get_code_segment_info_params.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo +from .file_uri import FileUri +from .symbol_type import SymbolType + +__all__ = ["LspGetCodeSegmentInfoParams"] + + +class LspGetCodeSegmentInfoParams(TypedDict, total=False): + symbol_name: Required[Annotated[str, PropertyInfo(alias="symbolName")]] + + uri: Required[FileUri] + + symbol_type: Annotated[SymbolType, PropertyInfo(alias="symbolType")] diff --git a/src/runloop_api_client/types/devboxes/lsp_get_signature_help_params.py b/src/runloop_api_client/types/devboxes/lsp_get_signature_help_params.py new file mode 100644 index 000000000..c15382de0 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_get_signature_help_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LspGetSignatureHelpParams"] + + +class LspGetSignatureHelpParams(TypedDict, total=False): + character: Required[float] + + line: Required[float] + + uri: Required[str] diff --git a/src/runloop_api_client/types/devboxes/lsp_references_params.py b/src/runloop_api_client/types/devboxes/lsp_references_params.py new file mode 100644 index 000000000..f84058b8b --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_references_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LspReferencesParams"] + + +class LspReferencesParams(TypedDict, total=False): + character: Required[float] + + line: Required[float] + + uri: Required[str] diff --git a/src/runloop_api_client/types/devboxes/lsp_set_watch_directory_params.py b/src/runloop_api_client/types/devboxes/lsp_set_watch_directory_params.py new file mode 100644 index 000000000..88abae178 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_set_watch_directory_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .file_path import FilePath + +__all__ = ["LspSetWatchDirectoryParams"] + + +class LspSetWatchDirectoryParams(TypedDict, total=False): + path: Required[FilePath] diff --git a/src/runloop_api_client/types/devboxes/lsp_set_watch_directory_response.py b/src/runloop_api_client/types/devboxes/lsp_set_watch_directory_response.py new file mode 100644 index 000000000..575252b7f --- /dev/null +++ b/src/runloop_api_client/types/devboxes/lsp_set_watch_directory_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["LspSetWatchDirectoryResponse"] + +LspSetWatchDirectoryResponse: TypeAlias = str diff --git a/src/runloop_api_client/types/devboxes/position.py b/src/runloop_api_client/types/devboxes/position.py new file mode 100644 index 000000000..8ae66b6ad --- /dev/null +++ b/src/runloop_api_client/types/devboxes/position.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .uinteger import Uinteger +from ..._models import BaseModel + +__all__ = ["Position"] + + +class Position(BaseModel): + character: Uinteger + """Character offset on a line in a document (zero-based). + + The meaning of this offset is determined by the negotiated + `PositionEncodingKind`. + + If the character value is greater than the line length it defaults back to the + line length. + """ + + line: Uinteger + """Line position in a document (zero-based). + + If a line number is greater than the number of lines in a document, it defaults + back to the number of lines in the document. If a line number is negative, it + defaults to 0. + """ diff --git a/src/runloop_api_client/types/devboxes/position_param.py b/src/runloop_api_client/types/devboxes/position_param.py new file mode 100644 index 000000000..0afee2ba3 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/position_param.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .uinteger import Uinteger + +__all__ = ["PositionParam"] + + +class PositionParam(TypedDict, total=False): + character: Required[Uinteger] + """Character offset on a line in a document (zero-based). + + The meaning of this offset is determined by the negotiated + `PositionEncodingKind`. + + If the character value is greater than the line length it defaults back to the + line length. + """ + + line: Required[Uinteger] + """Line position in a document (zero-based). + + If a line number is greater than the number of lines in a document, it defaults + back to the number of lines in the document. If a line number is negative, it + defaults to 0. + """ diff --git a/src/runloop_api_client/types/devboxes/range.py b/src/runloop_api_client/types/devboxes/range.py new file mode 100644 index 000000000..c9eaf78a6 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/range.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .position import Position +from ..._models import BaseModel + +__all__ = ["Range"] + + +class Range(BaseModel): + end: Position + """The range's end position.""" + + start: Position + """The range's start position.""" diff --git a/src/runloop_api_client/types/devboxes/range_param.py b/src/runloop_api_client/types/devboxes/range_param.py new file mode 100644 index 000000000..87a516655 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/range_param.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .position_param import PositionParam + +__all__ = ["RangeParam"] + + +class RangeParam(TypedDict, total=False): + end: Required[PositionParam] + """The range's end position.""" + + start: Required[PositionParam] + """The range's start position.""" diff --git a/src/runloop_api_client/types/devboxes/record_string_text_edit_array.py b/src/runloop_api_client/types/devboxes/record_string_text_edit_array.py new file mode 100644 index 000000000..84efd3ea0 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/record_string_text_edit_array.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List +from typing_extensions import TypeAlias + +from .text_edit import TextEdit + +__all__ = ["RecordStringTextEditArray"] + +RecordStringTextEditArray: TypeAlias = Dict[str, List[TextEdit]] diff --git a/src/runloop_api_client/types/devboxes/record_string_text_edit_array_param.py b/src/runloop_api_client/types/devboxes/record_string_text_edit_array_param.py new file mode 100644 index 000000000..19e7cf731 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/record_string_text_edit_array_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable +from typing_extensions import TypeAlias + +from .text_edit_param import TextEditParam + +__all__ = ["RecordStringTextEditArrayParam"] + +RecordStringTextEditArrayParam: TypeAlias = Dict[str, Iterable[TextEditParam]] diff --git a/src/runloop_api_client/types/devboxes/signature_help_response.py b/src/runloop_api_client/types/devboxes/signature_help_response.py new file mode 100644 index 000000000..1cf0ac4cb --- /dev/null +++ b/src/runloop_api_client/types/devboxes/signature_help_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .base_signature import BaseSignature + +__all__ = ["SignatureHelpResponse"] + + +class SignatureHelpResponse(BaseModel): + signatures: List[BaseSignature] + + active_parameter: Optional[float] = FieldInfo(alias="activeParameter", default=None) + + active_signature: Optional[float] = FieldInfo(alias="activeSignature", default=None) diff --git a/src/runloop_api_client/types/devboxes/symbol_kind.py b/src/runloop_api_client/types/devboxes/symbol_kind.py new file mode 100644 index 000000000..d21c01515 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/symbol_kind.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["SymbolKind"] + +SymbolKind: TypeAlias = Literal[ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 +] diff --git a/src/runloop_api_client/types/devboxes/symbol_tag.py b/src/runloop_api_client/types/devboxes/symbol_tag.py new file mode 100644 index 000000000..0779efce5 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/symbol_tag.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["SymbolTag"] + +SymbolTag: TypeAlias = Literal[1] diff --git a/src/runloop_api_client/types/devboxes/symbol_type.py b/src/runloop_api_client/types/devboxes/symbol_type.py new file mode 100644 index 000000000..1623bacf2 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/symbol_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["SymbolType"] + +SymbolType: TypeAlias = Literal["function", "variable", "class", "interface", "type"] diff --git a/src/runloop_api_client/types/devboxes/text_edit.py b/src/runloop_api_client/types/devboxes/text_edit.py new file mode 100644 index 000000000..e91fde3ff --- /dev/null +++ b/src/runloop_api_client/types/devboxes/text_edit.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from pydantic import Field as FieldInfo + +from .range import Range +from ..._models import BaseModel + +__all__ = ["TextEdit"] + + +class TextEdit(BaseModel): + new_text: str = FieldInfo(alias="newText") + """The string to be inserted. For delete operations use an empty string.""" + + range: Range + """The range of the text document to be manipulated. + + To insert text into a document create a range where start === end. + """ diff --git a/src/runloop_api_client/types/devboxes/text_edit_param.py b/src/runloop_api_client/types/devboxes/text_edit_param.py new file mode 100644 index 000000000..882a423c6 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/text_edit_param.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo +from .range_param import RangeParam + +__all__ = ["TextEditParam"] + + +class TextEditParam(TypedDict, total=False): + new_text: Required[Annotated[str, PropertyInfo(alias="newText")]] + """The string to be inserted. For delete operations use an empty string.""" + + range: Required[RangeParam] + """The range of the text document to be manipulated. + + To insert text into a document create a range where start === end. + """ diff --git a/src/runloop_api_client/types/devboxes/u_ri.py b/src/runloop_api_client/types/devboxes/u_ri.py new file mode 100644 index 000000000..132a3bd29 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/u_ri.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["URi"] + +URi: TypeAlias = str diff --git a/src/runloop_api_client/types/devboxes/uinteger.py b/src/runloop_api_client/types/devboxes/uinteger.py new file mode 100644 index 000000000..b1f8376cb --- /dev/null +++ b/src/runloop_api_client/types/devboxes/uinteger.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["Uinteger"] + +Uinteger: TypeAlias = float diff --git a/src/runloop_api_client/types/devboxes/watched_file_response.py b/src/runloop_api_client/types/devboxes/watched_file_response.py new file mode 100644 index 000000000..01884f8e8 --- /dev/null +++ b/src/runloop_api_client/types/devboxes/watched_file_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["WatchedFileResponse"] + + +class WatchedFileResponse(BaseModel): + filename: str + + full_path: str = FieldInfo(alias="fullPath") + + path: str diff --git a/src/runloop_api_client/types/repository_connection_list_view.py b/src/runloop_api_client/types/repository_connection_list_view.py new file mode 100644 index 000000000..4ad5a10ec --- /dev/null +++ b/src/runloop_api_client/types/repository_connection_list_view.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .repository_connection_view import RepositoryConnectionView + +__all__ = ["RepositoryConnectionListView"] + + +class RepositoryConnectionListView(BaseModel): + has_more: bool + + repositories: List[RepositoryConnectionView] + """List of repositories matching filter.""" + + total_count: int diff --git a/src/runloop_api_client/types/repository_connection_view.py b/src/runloop_api_client/types/repository_connection_view.py new file mode 100644 index 000000000..fdc3fff3f --- /dev/null +++ b/src/runloop_api_client/types/repository_connection_view.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["RepositoryConnectionView"] + + +class RepositoryConnectionView(BaseModel): + id: str + """The id of the Repository.""" + + name: str + """The name of the Repository.""" + + owner: str + """The account owner of the Repository.""" + + status: Literal["pending", "failure", "active"] + """The current status of the Repository.""" + + failure_reason: Optional[str] = None + """Reason for failure, if any.""" diff --git a/src/runloop_api_client/types/repository_create_params.py b/src/runloop_api_client/types/repository_create_params.py new file mode 100644 index 000000000..06864a447 --- /dev/null +++ b/src/runloop_api_client/types/repository_create_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RepositoryCreateParams"] + + +class RepositoryCreateParams(TypedDict, total=False): + name: Required[str] + """Name of the repository.""" + + owner: Required[str] + """Account owner of the repository.""" diff --git a/src/runloop_api_client/types/repository_list_params.py b/src/runloop_api_client/types/repository_list_params.py new file mode 100644 index 000000000..88c7993ba --- /dev/null +++ b/src/runloop_api_client/types/repository_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RepositoryListParams"] + + +class RepositoryListParams(TypedDict, total=False): + limit: int + """Page Limit""" + + starting_after: str + """Load the next page starting after the given token.""" diff --git a/src/runloop_api_client/types/repository_version_details.py b/src/runloop_api_client/types/repository_version_details.py new file mode 100644 index 000000000..8d6d2b0d8 --- /dev/null +++ b/src/runloop_api_client/types/repository_version_details.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["RepositoryVersionDetails", "ExtractedTools", "RepositorySetupDetails"] + + +class ExtractedTools(BaseModel): + commands: Dict[str, str] + """The set of available commands on this repository such as building etc.""" + + package_manager: str + """What package manager this repository uses.""" + + +class RepositorySetupDetails(BaseModel): + blueprint_id: str + """The blueprint built that supports setting up this repository.""" + + env_initialization_command: str + """Command to initialize the env we need to run the commands for this repository.""" + + workspace_setup: List[str] + """Setup commands necessary to support repository i.e. apt install XXX.""" + + +class RepositoryVersionDetails(BaseModel): + analyzed_at: int + """Analyzed time of the Repository Version (Unix timestamp milliseconds).""" + + commit_sha: str + """The sha of the analyzed version of the Repository.""" + + extracted_tools: ExtractedTools + """Tools discovered during inspection.""" + + repository_setup_details: RepositorySetupDetails + """Commands required to set up repository environment.""" + + status: Literal["inspecting", "inspection_failed", "success"] + """The account owner of the Repository.""" diff --git a/src/runloop_api_client/types/repository_version_list_view.py b/src/runloop_api_client/types/repository_version_list_view.py new file mode 100644 index 000000000..6e4872663 --- /dev/null +++ b/src/runloop_api_client/types/repository_version_list_view.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .repository_version_details import RepositoryVersionDetails + +__all__ = ["RepositoryVersionListView"] + + +class RepositoryVersionListView(BaseModel): + analyzed_versions: List[RepositoryVersionDetails] + """List of analyzed versions of this repository.""" diff --git a/tests/api_resources/devboxes/test_lsp.py b/tests/api_resources/devboxes/test_lsp.py new file mode 100644 index 000000000..8f02db8d8 --- /dev/null +++ b/tests/api_resources/devboxes/test_lsp.py @@ -0,0 +1,1607 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from runloop_api_client import Runloop, AsyncRunloop +from runloop_api_client.types.devboxes import ( + LspFilesResponse, + DiagnosticsResponse, + FileContentsResponse, + HealthStatusResponse, + SignatureHelpResponse, + CodeSegmentInfoResponse, + CodeActionApplicationResult, + LspGetCodeActionsForDiagnosticResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLsp: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_apply_code_action(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.apply_code_action( + id="id", + title="title", + ) + assert_matches_type(CodeActionApplicationResult, lsp, path=["response"]) + + @parametrize + def test_method_apply_code_action_with_all_params(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.apply_code_action( + id="id", + title="title", + command={ + "command": "command", + "title": "title", + "arguments": [{}], + }, + edit={ + "changes": { + "foo": [ + { + "new_text": "newText", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + } + ] + } + }, + is_preferred=True, + ) + assert_matches_type(CodeActionApplicationResult, lsp, path=["response"]) + + @parametrize + def test_raw_response_apply_code_action(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.apply_code_action( + id="id", + title="title", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(CodeActionApplicationResult, lsp, path=["response"]) + + @parametrize + def test_streaming_response_apply_code_action(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.apply_code_action( + id="id", + title="title", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(CodeActionApplicationResult, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_apply_code_action(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.apply_code_action( + id="", + title="title", + ) + + @parametrize + def test_method_code_actions(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.code_actions( + id="id", + uri="uri", + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_method_code_actions_with_all_params(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.code_actions( + id="id", + uri="uri", + context={ + "diagnostics": [ + { + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + "code": 0, + "code_description": {"href": "href"}, + "data": {}, + "related_information": [ + { + "location": { + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + "uri": "uri", + }, + "message": "message", + } + ], + "severity": 1, + "source": "source", + "tags": [1], + } + ], + "only": ["string"], + "trigger_kind": 1, + }, + range={ + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_raw_response_code_actions(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.code_actions( + id="id", + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_streaming_response_code_actions(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.code_actions( + id="id", + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(object, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_code_actions(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.code_actions( + id="", + uri="uri", + ) + + @parametrize + def test_method_diagnostics(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.diagnostics( + id="id", + uri="uri", + ) + assert_matches_type(DiagnosticsResponse, lsp, path=["response"]) + + @parametrize + def test_raw_response_diagnostics(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.diagnostics( + id="id", + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(DiagnosticsResponse, lsp, path=["response"]) + + @parametrize + def test_streaming_response_diagnostics(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.diagnostics( + id="id", + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(DiagnosticsResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_diagnostics(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.diagnostics( + id="", + uri="uri", + ) + + @parametrize + def test_method_document_symbols(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.document_symbols( + id="id", + uri="uri", + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_raw_response_document_symbols(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.document_symbols( + id="id", + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_streaming_response_document_symbols(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.document_symbols( + id="id", + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(object, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_document_symbols(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.document_symbols( + id="", + uri="uri", + ) + + @parametrize + def test_method_file(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.file( + id="id", + path="path", + ) + assert_matches_type(FileContentsResponse, lsp, path=["response"]) + + @parametrize + def test_raw_response_file(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.file( + id="id", + path="path", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(FileContentsResponse, lsp, path=["response"]) + + @parametrize + def test_streaming_response_file(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.file( + id="id", + path="path", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(FileContentsResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_file(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.file( + id="", + path="path", + ) + + @parametrize + def test_method_file_definition(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.file_definition( + id="id", + character=0, + line=0, + uri="uri", + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_raw_response_file_definition(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.file_definition( + id="id", + character=0, + line=0, + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_streaming_response_file_definition(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.file_definition( + id="id", + character=0, + line=0, + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(object, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_file_definition(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.file_definition( + id="", + character=0, + line=0, + uri="uri", + ) + + @parametrize + def test_method_files(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.files( + "id", + ) + assert_matches_type(LspFilesResponse, lsp, path=["response"]) + + @parametrize + def test_raw_response_files(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.files( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(LspFilesResponse, lsp, path=["response"]) + + @parametrize + def test_streaming_response_files(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.files( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(LspFilesResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_files(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.files( + "", + ) + + @parametrize + def test_method_formatting(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.formatting( + id="id", + uri="uri", + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_raw_response_formatting(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.formatting( + id="id", + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_streaming_response_formatting(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.formatting( + id="id", + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(object, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_formatting(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.formatting( + id="", + uri="uri", + ) + + @parametrize + def test_method_get_code_actions_for_diagnostic(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.get_code_actions_for_diagnostic( + id="id", + diagnostic={ + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + }, + uri="uri", + ) + assert_matches_type(LspGetCodeActionsForDiagnosticResponse, lsp, path=["response"]) + + @parametrize + def test_method_get_code_actions_for_diagnostic_with_all_params(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.get_code_actions_for_diagnostic( + id="id", + diagnostic={ + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + "code": 0, + "severity": 1, + "source": "source", + }, + uri="uri", + ) + assert_matches_type(LspGetCodeActionsForDiagnosticResponse, lsp, path=["response"]) + + @parametrize + def test_raw_response_get_code_actions_for_diagnostic(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.get_code_actions_for_diagnostic( + id="id", + diagnostic={ + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + }, + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(LspGetCodeActionsForDiagnosticResponse, lsp, path=["response"]) + + @parametrize + def test_streaming_response_get_code_actions_for_diagnostic(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.get_code_actions_for_diagnostic( + id="id", + diagnostic={ + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + }, + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(LspGetCodeActionsForDiagnosticResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_code_actions_for_diagnostic(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.get_code_actions_for_diagnostic( + id="", + diagnostic={ + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + }, + uri="uri", + ) + + @parametrize + def test_method_get_code_segment_info(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.get_code_segment_info( + id="id", + symbol_name="symbolName", + uri="uri", + ) + assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"]) + + @parametrize + def test_method_get_code_segment_info_with_all_params(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.get_code_segment_info( + id="id", + symbol_name="symbolName", + uri="uri", + symbol_type="function", + ) + assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"]) + + @parametrize + def test_raw_response_get_code_segment_info(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.get_code_segment_info( + id="id", + symbol_name="symbolName", + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"]) + + @parametrize + def test_streaming_response_get_code_segment_info(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.get_code_segment_info( + id="id", + symbol_name="symbolName", + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_code_segment_info(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.get_code_segment_info( + id="", + symbol_name="symbolName", + uri="uri", + ) + + @parametrize + def test_method_get_signature_help(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.get_signature_help( + id="id", + character=0, + line=0, + uri="uri", + ) + assert_matches_type(SignatureHelpResponse, lsp, path=["response"]) + + @parametrize + def test_raw_response_get_signature_help(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.get_signature_help( + id="id", + character=0, + line=0, + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(SignatureHelpResponse, lsp, path=["response"]) + + @parametrize + def test_streaming_response_get_signature_help(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.get_signature_help( + id="id", + character=0, + line=0, + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(SignatureHelpResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_signature_help(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.get_signature_help( + id="", + character=0, + line=0, + uri="uri", + ) + + @parametrize + def test_method_health(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.health( + "id", + ) + assert_matches_type(HealthStatusResponse, lsp, path=["response"]) + + @parametrize + def test_raw_response_health(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.health( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(HealthStatusResponse, lsp, path=["response"]) + + @parametrize + def test_streaming_response_health(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.health( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(HealthStatusResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_health(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.health( + "", + ) + + @parametrize + def test_method_references(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.references( + id="id", + character=0, + line=0, + uri="uri", + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_raw_response_references(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.references( + id="id", + character=0, + line=0, + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + def test_streaming_response_references(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.references( + id="id", + character=0, + line=0, + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(object, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_references(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.references( + id="", + character=0, + line=0, + uri="uri", + ) + + @parametrize + def test_method_set_watch_directory(self, client: Runloop) -> None: + lsp = client.devboxes.lsp.set_watch_directory( + id="id", + path="path", + ) + assert_matches_type(str, lsp, path=["response"]) + + @parametrize + def test_raw_response_set_watch_directory(self, client: Runloop) -> None: + response = client.devboxes.lsp.with_raw_response.set_watch_directory( + id="id", + path="path", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = response.parse() + assert_matches_type(str, lsp, path=["response"]) + + @parametrize + def test_streaming_response_set_watch_directory(self, client: Runloop) -> None: + with client.devboxes.lsp.with_streaming_response.set_watch_directory( + id="id", + path="path", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = response.parse() + assert_matches_type(str, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_set_watch_directory(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.lsp.with_raw_response.set_watch_directory( + id="", + path="path", + ) + + +class TestAsyncLsp: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_apply_code_action(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.apply_code_action( + id="id", + title="title", + ) + assert_matches_type(CodeActionApplicationResult, lsp, path=["response"]) + + @parametrize + async def test_method_apply_code_action_with_all_params(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.apply_code_action( + id="id", + title="title", + command={ + "command": "command", + "title": "title", + "arguments": [{}], + }, + edit={ + "changes": { + "foo": [ + { + "new_text": "newText", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + } + ] + } + }, + is_preferred=True, + ) + assert_matches_type(CodeActionApplicationResult, lsp, path=["response"]) + + @parametrize + async def test_raw_response_apply_code_action(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.apply_code_action( + id="id", + title="title", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(CodeActionApplicationResult, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_apply_code_action(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.apply_code_action( + id="id", + title="title", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(CodeActionApplicationResult, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_apply_code_action(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.apply_code_action( + id="", + title="title", + ) + + @parametrize + async def test_method_code_actions(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.code_actions( + id="id", + uri="uri", + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_method_code_actions_with_all_params(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.code_actions( + id="id", + uri="uri", + context={ + "diagnostics": [ + { + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + "code": 0, + "code_description": {"href": "href"}, + "data": {}, + "related_information": [ + { + "location": { + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + "uri": "uri", + }, + "message": "message", + } + ], + "severity": 1, + "source": "source", + "tags": [1], + } + ], + "only": ["string"], + "trigger_kind": 1, + }, + range={ + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_raw_response_code_actions(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.code_actions( + id="id", + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_code_actions(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.code_actions( + id="id", + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(object, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_code_actions(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.code_actions( + id="", + uri="uri", + ) + + @parametrize + async def test_method_diagnostics(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.diagnostics( + id="id", + uri="uri", + ) + assert_matches_type(DiagnosticsResponse, lsp, path=["response"]) + + @parametrize + async def test_raw_response_diagnostics(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.diagnostics( + id="id", + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(DiagnosticsResponse, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_diagnostics(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.diagnostics( + id="id", + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(DiagnosticsResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_diagnostics(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.diagnostics( + id="", + uri="uri", + ) + + @parametrize + async def test_method_document_symbols(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.document_symbols( + id="id", + uri="uri", + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_raw_response_document_symbols(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.document_symbols( + id="id", + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_document_symbols(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.document_symbols( + id="id", + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(object, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_document_symbols(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.document_symbols( + id="", + uri="uri", + ) + + @parametrize + async def test_method_file(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.file( + id="id", + path="path", + ) + assert_matches_type(FileContentsResponse, lsp, path=["response"]) + + @parametrize + async def test_raw_response_file(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.file( + id="id", + path="path", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(FileContentsResponse, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_file(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.file( + id="id", + path="path", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(FileContentsResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_file(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.file( + id="", + path="path", + ) + + @parametrize + async def test_method_file_definition(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.file_definition( + id="id", + character=0, + line=0, + uri="uri", + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_raw_response_file_definition(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.file_definition( + id="id", + character=0, + line=0, + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_file_definition(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.file_definition( + id="id", + character=0, + line=0, + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(object, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_file_definition(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.file_definition( + id="", + character=0, + line=0, + uri="uri", + ) + + @parametrize + async def test_method_files(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.files( + "id", + ) + assert_matches_type(LspFilesResponse, lsp, path=["response"]) + + @parametrize + async def test_raw_response_files(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.files( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(LspFilesResponse, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_files(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.files( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(LspFilesResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_files(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.files( + "", + ) + + @parametrize + async def test_method_formatting(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.formatting( + id="id", + uri="uri", + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_raw_response_formatting(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.formatting( + id="id", + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_formatting(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.formatting( + id="id", + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(object, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_formatting(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.formatting( + id="", + uri="uri", + ) + + @parametrize + async def test_method_get_code_actions_for_diagnostic(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.get_code_actions_for_diagnostic( + id="id", + diagnostic={ + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + }, + uri="uri", + ) + assert_matches_type(LspGetCodeActionsForDiagnosticResponse, lsp, path=["response"]) + + @parametrize + async def test_method_get_code_actions_for_diagnostic_with_all_params(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.get_code_actions_for_diagnostic( + id="id", + diagnostic={ + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + "code": 0, + "severity": 1, + "source": "source", + }, + uri="uri", + ) + assert_matches_type(LspGetCodeActionsForDiagnosticResponse, lsp, path=["response"]) + + @parametrize + async def test_raw_response_get_code_actions_for_diagnostic(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.get_code_actions_for_diagnostic( + id="id", + diagnostic={ + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + }, + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(LspGetCodeActionsForDiagnosticResponse, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_get_code_actions_for_diagnostic(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.get_code_actions_for_diagnostic( + id="id", + diagnostic={ + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + }, + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(LspGetCodeActionsForDiagnosticResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_code_actions_for_diagnostic(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.get_code_actions_for_diagnostic( + id="", + diagnostic={ + "message": "message", + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + }, + uri="uri", + ) + + @parametrize + async def test_method_get_code_segment_info(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.get_code_segment_info( + id="id", + symbol_name="symbolName", + uri="uri", + ) + assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"]) + + @parametrize + async def test_method_get_code_segment_info_with_all_params(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.get_code_segment_info( + id="id", + symbol_name="symbolName", + uri="uri", + symbol_type="function", + ) + assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"]) + + @parametrize + async def test_raw_response_get_code_segment_info(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.get_code_segment_info( + id="id", + symbol_name="symbolName", + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_get_code_segment_info(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.get_code_segment_info( + id="id", + symbol_name="symbolName", + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_code_segment_info(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.get_code_segment_info( + id="", + symbol_name="symbolName", + uri="uri", + ) + + @parametrize + async def test_method_get_signature_help(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.get_signature_help( + id="id", + character=0, + line=0, + uri="uri", + ) + assert_matches_type(SignatureHelpResponse, lsp, path=["response"]) + + @parametrize + async def test_raw_response_get_signature_help(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.get_signature_help( + id="id", + character=0, + line=0, + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(SignatureHelpResponse, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_get_signature_help(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.get_signature_help( + id="id", + character=0, + line=0, + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(SignatureHelpResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_signature_help(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.get_signature_help( + id="", + character=0, + line=0, + uri="uri", + ) + + @parametrize + async def test_method_health(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.health( + "id", + ) + assert_matches_type(HealthStatusResponse, lsp, path=["response"]) + + @parametrize + async def test_raw_response_health(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.health( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(HealthStatusResponse, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_health(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.health( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(HealthStatusResponse, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_health(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.health( + "", + ) + + @parametrize + async def test_method_references(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.references( + id="id", + character=0, + line=0, + uri="uri", + ) + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_raw_response_references(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.references( + id="id", + character=0, + line=0, + uri="uri", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(object, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_references(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.references( + id="id", + character=0, + line=0, + uri="uri", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(object, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_references(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.references( + id="", + character=0, + line=0, + uri="uri", + ) + + @parametrize + async def test_method_set_watch_directory(self, async_client: AsyncRunloop) -> None: + lsp = await async_client.devboxes.lsp.set_watch_directory( + id="id", + path="path", + ) + assert_matches_type(str, lsp, path=["response"]) + + @parametrize + async def test_raw_response_set_watch_directory(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.lsp.with_raw_response.set_watch_directory( + id="id", + path="path", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lsp = await response.parse() + assert_matches_type(str, lsp, path=["response"]) + + @parametrize + async def test_streaming_response_set_watch_directory(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.lsp.with_streaming_response.set_watch_directory( + id="id", + path="path", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lsp = await response.parse() + assert_matches_type(str, lsp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_set_watch_directory(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.lsp.with_raw_response.set_watch_directory( + id="", + path="path", + ) diff --git a/tests/api_resources/test_repositories.py b/tests/api_resources/test_repositories.py new file mode 100644 index 000000000..5aec67a48 --- /dev/null +++ b/tests/api_resources/test_repositories.py @@ -0,0 +1,388 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from runloop_api_client import Runloop, AsyncRunloop +from runloop_api_client.types import ( + RepositoryConnectionView, + RepositoryVersionListView, + RepositoryConnectionListView, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRepositories: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Runloop) -> None: + repository = client.repositories.create( + name="name", + owner="owner", + ) + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Runloop) -> None: + response = client.repositories.with_raw_response.create( + name="name", + owner="owner", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = response.parse() + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Runloop) -> None: + with client.repositories.with_streaming_response.create( + name="name", + owner="owner", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = response.parse() + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Runloop) -> None: + repository = client.repositories.retrieve( + "id", + ) + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Runloop) -> None: + response = client.repositories.with_raw_response.retrieve( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = response.parse() + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Runloop) -> None: + with client.repositories.with_streaming_response.retrieve( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = response.parse() + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.repositories.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Runloop) -> None: + repository = client.repositories.list() + assert_matches_type(RepositoryConnectionListView, repository, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Runloop) -> None: + repository = client.repositories.list( + limit=0, + starting_after="starting_after", + ) + assert_matches_type(RepositoryConnectionListView, repository, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Runloop) -> None: + response = client.repositories.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = response.parse() + assert_matches_type(RepositoryConnectionListView, repository, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Runloop) -> None: + with client.repositories.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = response.parse() + assert_matches_type(RepositoryConnectionListView, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Runloop) -> None: + repository = client.repositories.delete( + "id", + ) + assert_matches_type(object, repository, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Runloop) -> None: + response = client.repositories.with_raw_response.delete( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = response.parse() + assert_matches_type(object, repository, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Runloop) -> None: + with client.repositories.with_streaming_response.delete( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = response.parse() + assert_matches_type(object, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.repositories.with_raw_response.delete( + "", + ) + + @parametrize + def test_method_versions(self, client: Runloop) -> None: + repository = client.repositories.versions( + "id", + ) + assert_matches_type(RepositoryVersionListView, repository, path=["response"]) + + @parametrize + def test_raw_response_versions(self, client: Runloop) -> None: + response = client.repositories.with_raw_response.versions( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = response.parse() + assert_matches_type(RepositoryVersionListView, repository, path=["response"]) + + @parametrize + def test_streaming_response_versions(self, client: Runloop) -> None: + with client.repositories.with_streaming_response.versions( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = response.parse() + assert_matches_type(RepositoryVersionListView, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_versions(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.repositories.with_raw_response.versions( + "", + ) + + +class TestAsyncRepositories: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncRunloop) -> None: + repository = await async_client.repositories.create( + name="name", + owner="owner", + ) + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncRunloop) -> None: + response = await async_client.repositories.with_raw_response.create( + name="name", + owner="owner", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = await response.parse() + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncRunloop) -> None: + async with async_client.repositories.with_streaming_response.create( + name="name", + owner="owner", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = await response.parse() + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncRunloop) -> None: + repository = await async_client.repositories.retrieve( + "id", + ) + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncRunloop) -> None: + response = await async_client.repositories.with_raw_response.retrieve( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = await response.parse() + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncRunloop) -> None: + async with async_client.repositories.with_streaming_response.retrieve( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = await response.parse() + assert_matches_type(RepositoryConnectionView, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.repositories.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncRunloop) -> None: + repository = await async_client.repositories.list() + assert_matches_type(RepositoryConnectionListView, repository, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncRunloop) -> None: + repository = await async_client.repositories.list( + limit=0, + starting_after="starting_after", + ) + assert_matches_type(RepositoryConnectionListView, repository, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: + response = await async_client.repositories.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = await response.parse() + assert_matches_type(RepositoryConnectionListView, repository, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None: + async with async_client.repositories.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = await response.parse() + assert_matches_type(RepositoryConnectionListView, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncRunloop) -> None: + repository = await async_client.repositories.delete( + "id", + ) + assert_matches_type(object, repository, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncRunloop) -> None: + response = await async_client.repositories.with_raw_response.delete( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = await response.parse() + assert_matches_type(object, repository, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncRunloop) -> None: + async with async_client.repositories.with_streaming_response.delete( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = await response.parse() + assert_matches_type(object, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.repositories.with_raw_response.delete( + "", + ) + + @parametrize + async def test_method_versions(self, async_client: AsyncRunloop) -> None: + repository = await async_client.repositories.versions( + "id", + ) + assert_matches_type(RepositoryVersionListView, repository, path=["response"]) + + @parametrize + async def test_raw_response_versions(self, async_client: AsyncRunloop) -> None: + response = await async_client.repositories.with_raw_response.versions( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = await response.parse() + assert_matches_type(RepositoryVersionListView, repository, path=["response"]) + + @parametrize + async def test_streaming_response_versions(self, async_client: AsyncRunloop) -> None: + async with async_client.repositories.with_streaming_response.versions( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = await response.parse() + assert_matches_type(RepositoryVersionListView, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_versions(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.repositories.with_raw_response.versions( + "", + )