|
2 | 2 |
|
3 | 3 | from .sdkconfiguration import SDKConfiguration |
4 | 4 | from airbyte import utils |
5 | | -from airbyte.models import operations, shared |
| 5 | +from airbyte.models import errors, operations, shared |
6 | 6 | from typing import Optional |
7 | 7 |
|
8 | 8 | class Destinations: |
@@ -37,6 +37,8 @@ def create_destination(self, request: shared.DestinationCreateRequest) -> operat |
37 | 37 | if utils.match_content_type(content_type, 'application/json'): |
38 | 38 | out = utils.unmarshal_json(http_res.text, Optional[shared.DestinationResponse]) |
39 | 39 | res.destination_response = out |
| 40 | + else: |
| 41 | + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) |
40 | 42 | elif http_res.status_code in [400, 403, 404]: |
41 | 43 | pass |
42 | 44 |
|
@@ -83,6 +85,8 @@ def get_destination(self, request: operations.GetDestinationRequest) -> operatio |
83 | 85 | if utils.match_content_type(content_type, 'application/json'): |
84 | 86 | out = utils.unmarshal_json(http_res.text, Optional[shared.DestinationResponse]) |
85 | 87 | res.destination_response = out |
| 88 | + else: |
| 89 | + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) |
86 | 90 | elif http_res.status_code in [403, 404]: |
87 | 91 | pass |
88 | 92 |
|
@@ -110,6 +114,8 @@ def list_destinations(self, request: operations.ListDestinationsRequest) -> oper |
110 | 114 | if utils.match_content_type(content_type, 'application/json'): |
111 | 115 | out = utils.unmarshal_json(http_res.text, Optional[shared.DestinationsResponse]) |
112 | 116 | res.destinations_response = out |
| 117 | + else: |
| 118 | + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) |
113 | 119 | elif http_res.status_code in [403, 404]: |
114 | 120 | pass |
115 | 121 |
|
@@ -139,6 +145,8 @@ def patch_destination(self, request: operations.PatchDestinationRequest) -> oper |
139 | 145 | if utils.match_content_type(content_type, 'application/json'): |
140 | 146 | out = utils.unmarshal_json(http_res.text, Optional[shared.DestinationResponse]) |
141 | 147 | res.destination_response = out |
| 148 | + else: |
| 149 | + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) |
142 | 150 | elif http_res.status_code in [403, 404]: |
143 | 151 | pass |
144 | 152 |
|
@@ -168,6 +176,8 @@ def put_destination(self, request: operations.PutDestinationRequest) -> operatio |
168 | 176 | if utils.match_content_type(content_type, 'application/json'): |
169 | 177 | out = utils.unmarshal_json(http_res.text, Optional[shared.DestinationResponse]) |
170 | 178 | res.destination_response = out |
| 179 | + else: |
| 180 | + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) |
171 | 181 | elif http_res.status_code in [403, 404]: |
172 | 182 | pass |
173 | 183 |
|
|
0 commit comments