Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions javelin_sdk/services/gateway_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,23 @@ def create_gateway(self, gateway: Gateway) -> str:
if gateway.name:
self._validate_gateway_name(gateway.name)
response = self.client._send_request_sync(
Request(method=HttpMethod.POST, gateway=gateway.name, data=gateway.dict())
Request(
method=HttpMethod.POST,
gateway=gateway.name,
data=gateway.dict(exclude_none=True),
Comment thread
abhijitjavelin marked this conversation as resolved.
)
)
return self._process_gateway_response_ok(response)

async def acreate_gateway(self, gateway: Gateway) -> str:
if gateway.name:
self._validate_gateway_name(gateway.name)
response = await self.client._send_request_async(
Request(method=HttpMethod.POST, gateway=gateway.name, data=gateway.dict())
Request(
method=HttpMethod.POST,
gateway=gateway.name,
data=gateway.dict(exclude_none=True),
Comment thread
abhijitjavelin marked this conversation as resolved.
)
)
return self._process_gateway_response_ok(response)

Expand Down
8 changes: 6 additions & 2 deletions javelin_sdk/services/provider_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def create_provider(self, provider) -> str:
self._validate_provider_name(provider.name)
response = self.client._send_request_sync(
Request(
method=HttpMethod.POST, provider=provider.name, data=provider.dict()
method=HttpMethod.POST,
provider=provider.name,
data=provider.dict(exclude_none=True),
Comment thread
abhijitjavelin marked this conversation as resolved.
)
)
return self._process_provider_response_ok(response)
Expand All @@ -78,7 +80,9 @@ async def acreate_provider(self, provider) -> str:
self._validate_provider_name(provider.name)
response = await self.client._send_request_async(
Request(
method=HttpMethod.POST, provider=provider.name, data=provider.dict()
method=HttpMethod.POST,
provider=provider.name,
data=provider.dict(exclude_none=True),
Comment thread
abhijitjavelin marked this conversation as resolved.
)
)
return self._process_provider_response_ok(response)
Expand Down
12 changes: 10 additions & 2 deletions javelin_sdk/services/route_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def create_route(self, route) -> str:
route = Route.model_validate(route)
self._validate_route_name(route.name)
response = self.client._send_request_sync(
Request(method=HttpMethod.POST, route=route.name, data=route.dict())
Request(
method=HttpMethod.POST,
route=route.name,
data=route.dict(exclude_none=True),
Comment on lines +71 to +73
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding exclude_none=True to the route.dict() call ensures that null values are removed from the request body. This is the main goal of the pull request, and it's correctly implemented here.

)
)
return self._process_route_response_ok(response)

Expand All @@ -76,7 +80,11 @@ async def acreate_route(self, route) -> str:
route = Route.model_validate(route)
self._validate_route_name(route.name)
response = await self.client._send_request_async(
Request(method=HttpMethod.POST, route=route.name, data=route.dict())
Request(
method=HttpMethod.POST,
route=route.name,
data=route.dict(exclude_none=True),
Comment on lines +84 to +86
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding exclude_none=True to the route.dict() call ensures that null values are removed from the request body. This is the main goal of the pull request, and it's correctly implemented here.

)
)
return self._process_route_response_ok(response)

Expand Down
4 changes: 2 additions & 2 deletions javelin_sdk/services/secret_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def update_secret(self, secret) -> str:
Request(
method=HttpMethod.PUT,
secret=secret.api_key,
data=secret.dict(),
data=secret.dict(exclude_none=True),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding exclude_none=True to the secret.dict() call ensures that null values are removed from the request body. This is the main goal of the pull request, and it's correctly implemented here.

provider=secret.provider_name,
)
)
Expand Down Expand Up @@ -172,7 +172,7 @@ async def aupdate_secret(self, secret) -> str:
Request(
method=HttpMethod.PUT,
secret=secret.api_key,
data=secret.dict(),
data=secret.dict(exclude_none=True),
Comment thread
abhijitjavelin marked this conversation as resolved.
provider=secret.provider_name,
)
)
Expand Down
20 changes: 16 additions & 4 deletions javelin_sdk/services/template_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def create_template(self, template) -> str:
template = Template.model_validate(template)
response = self.client._send_request_sync(
Request(
method=HttpMethod.POST, template=template.name, data=template.dict()
method=HttpMethod.POST,
template=template.name,
data=template.dict(exclude_none=True),
Comment thread
abhijitjavelin marked this conversation as resolved.
)
)
if template.name:
Expand All @@ -56,7 +58,9 @@ async def acreate_template(self, template) -> str:
template = Template.model_validate(template)
response = await self.client._send_request_async(
Request(
method=HttpMethod.POST, template=template.name, data=template.dict()
method=HttpMethod.POST,
template=template.name,
data=template.dict(exclude_none=True),
Comment thread
abhijitjavelin marked this conversation as resolved.
)
)
if template.name:
Expand Down Expand Up @@ -105,7 +109,11 @@ def update_template(self, template) -> str:
if not isinstance(template, Template):
template = Template.model_validate(template)
response = self.client._send_request_sync(
Request(method=HttpMethod.PUT, template=template.name, data=template.dict())
Request(
method=HttpMethod.PUT,
template=template.name,
data=template.dict(exclude_none=True),
Comment thread
abhijitjavelin marked this conversation as resolved.
)
)
if template.name:
self.reload_data_protection(template.name)
Expand All @@ -115,7 +123,11 @@ async def aupdate_template(self, template) -> str:
if not isinstance(template, Template):
template = Template.model_validate(template)
response = await self.client._send_request_async(
Request(method=HttpMethod.PUT, template=template.name, data=template.dict())
Request(
method=HttpMethod.PUT,
template=template.name,
data=template.dict(exclude_none=True),
Comment thread
abhijitjavelin marked this conversation as resolved.
)
)
if template.name:
await self.areload_data_protection(template.name)
Expand Down
Loading