Skip to content

Commit 9420c54

Browse files
authored
Generate kagglesdk from latest protos (#690)
This is the output from `kapigen` using the current proto files. All generated code.
1 parent 3dd6d38 commit 9420c54

File tree

18 files changed

+928
-467
lines changed

18 files changed

+928
-467
lines changed

kagglesdk/models/services/model_api_service.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from kagglesdk.common.types.http_redirect import HttpRedirect
22
from kagglesdk.kaggle_http_client import KaggleHttpClient
3-
from kagglesdk.models.types.model_api_service import ApiCreateModelInstanceRequest, ApiCreateModelInstanceVersionRequest, ApiCreateModelRequest, ApiCreateModelResponse, ApiDeleteModelInstanceRequest, ApiDeleteModelInstanceVersionRequest, ApiDeleteModelRequest, ApiDeleteModelResponse, ApiDownloadModelInstanceVersionRequest, ApiGetModelInstanceRequest, ApiGetModelRequest, ApiListModelGatingUserConsentsRequest, ApiListModelGatingUserConsentsResponse, ApiListModelInstanceVersionFilesRequest, ApiListModelInstanceVersionFilesResponse, ApiListModelsRequest, ApiListModelsResponse, ApiModel, ApiModelInstance, ApiUpdateModelInstanceRequest, ApiUpdateModelRequest, ApiUpdateModelResponse, ApiUploadModelFileRequest, ApiUploadModelFileResponse, CreateModelSigningTokenRequest, CreateModelSigningTokenResponse, KeysRequest, KeysResponse, WellKnowEndpointRequest, WellKnowEndpointResponse
3+
from kagglesdk.models.types.model_api_service import ApiCreateModelInstanceRequest, ApiCreateModelInstanceVersionRequest, ApiCreateModelRequest, ApiCreateModelResponse, ApiDeleteModelInstanceRequest, ApiDeleteModelInstanceVersionRequest, ApiDeleteModelRequest, ApiDeleteModelResponse, ApiDownloadModelInstanceVersionRequest, ApiGetModelInstanceRequest, ApiGetModelRequest, ApiListModelGatingUserConsentsRequest, ApiListModelGatingUserConsentsResponse, ApiListModelInstanceVersionFilesRequest, ApiListModelInstanceVersionFilesResponse, ApiListModelsRequest, ApiListModelsResponse, ApiModel, ApiModelInstance, ApiReviewGatingUserConsentRequest, ApiUpdateModelInstanceRequest, ApiUpdateModelRequest, ApiUpdateModelResponse, ApiUploadModelFileRequest, ApiUploadModelFileResponse, CreateModelSigningTokenRequest, CreateModelSigningTokenResponse, KeysRequest, KeysResponse, WellKnowEndpointRequest, WellKnowEndpointResponse
44

55
class ModelApiClient(object):
66

@@ -239,3 +239,17 @@ def list_model_gating_user_consents(self, request: ApiListModelGatingUserConsent
239239
request = ApiListModelGatingUserConsentsRequest()
240240

241241
return self._client.call("models.ModelApiService", "ApiListModelGatingUserConsents", request, ApiListModelGatingUserConsentsResponse)
242+
243+
def review_gating_user_consent(self, request: ApiReviewGatingUserConsentRequest = None):
244+
r"""
245+
Review the user consents for an agreement.
246+
247+
Args:
248+
request (ApiReviewGatingUserConsentRequest):
249+
The request object; initialized to empty instance if not specified.
250+
"""
251+
252+
if request is None:
253+
request = ApiReviewGatingUserConsentRequest()
254+
255+
self._client.call("models.ModelApiService", "ApiReviewGatingUserConsent", request, None)

kagglesdk/models/types/model_api_service.py

Lines changed: 271 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from kagglesdk.datasets.types.dataset_api_service import ApiCategory, ApiDatasetNewFile, ApiUploadDirectoryInfo
44
from kagglesdk.kaggle_object import *
55
from kagglesdk.models.types.model_enums import GatingAgreementRequestsExpiryStatus, GatingAgreementRequestsReviewStatus, ListModelsOrderBy, ModelFramework, ModelInstanceType
6-
from kagglesdk.models.types.model_types import BaseModelInstanceInformation, GatingUserConsent, ModelLink
6+
from kagglesdk.models.types.model_types import BaseModelInstanceInformation, ModelLink
77
from typing import Optional, List
88

99
class ApiCreateModelInstanceRequest(KaggleObject):
@@ -1291,8 +1291,7 @@ def endpoint_path():
12911291
class ApiListModelGatingUserConsentsResponse(KaggleObject):
12921292
r"""
12931293
Attributes:
1294-
gating_user_consents (GatingUserConsent)
1295-
gating_user_consents.request_data is AUDIT_EXEMPT.
1294+
gating_user_consents (ApiGatingUserConsent)
12961295
total_size (int)
12971296
next_page_token (str)
12981297
"""
@@ -1304,19 +1303,18 @@ def __init__(self):
13041303
self._freeze()
13051304

13061305
@property
1307-
def gating_user_consents(self) -> Optional[List[Optional['GatingUserConsent']]]:
1308-
"""gating_user_consents.request_data is AUDIT_EXEMPT."""
1306+
def gating_user_consents(self) -> Optional[List[Optional['ApiGatingUserConsent']]]:
13091307
return self._gating_user_consents
13101308

13111309
@gating_user_consents.setter
1312-
def gating_user_consents(self, gating_user_consents: Optional[List[Optional['GatingUserConsent']]]):
1310+
def gating_user_consents(self, gating_user_consents: Optional[List[Optional['ApiGatingUserConsent']]]):
13131311
if gating_user_consents is None:
13141312
del self.gating_user_consents
13151313
return
13161314
if not isinstance(gating_user_consents, list):
13171315
raise TypeError('gating_user_consents must be of type list')
1318-
if not all([isinstance(t, GatingUserConsent) for t in gating_user_consents]):
1319-
raise TypeError('gating_user_consents must contain only items of type GatingUserConsent')
1316+
if not all([isinstance(t, ApiGatingUserConsent) for t in gating_user_consents]):
1317+
raise TypeError('gating_user_consents must contain only items of type ApiGatingUserConsent')
13201318
self._gating_user_consents = gating_user_consents
13211319

13221320
@property
@@ -2243,6 +2241,88 @@ def total_uncompressed_bytes(self, total_uncompressed_bytes: int):
22432241
self._total_uncompressed_bytes = total_uncompressed_bytes
22442242

22452243

2244+
class ApiReviewGatingUserConsentRequest(KaggleObject):
2245+
r"""
2246+
Attributes:
2247+
agreement_id (int)
2248+
user_name (str)
2249+
review_status (GatingAgreementRequestsReviewStatus)
2250+
publisher_notes (str)
2251+
"""
2252+
2253+
def __init__(self):
2254+
self._agreement_id = 0
2255+
self._user_name = ""
2256+
self._review_status = GatingAgreementRequestsReviewStatus.GATING_AGREEMENT_REQUESTS_REVIEW_STATUS_UNSPECIFIED
2257+
self._publisher_notes = None
2258+
self._freeze()
2259+
2260+
@property
2261+
def agreement_id(self) -> int:
2262+
return self._agreement_id
2263+
2264+
@agreement_id.setter
2265+
def agreement_id(self, agreement_id: int):
2266+
if agreement_id is None:
2267+
del self.agreement_id
2268+
return
2269+
if not isinstance(agreement_id, int):
2270+
raise TypeError('agreement_id must be of type int')
2271+
self._agreement_id = agreement_id
2272+
2273+
@property
2274+
def user_name(self) -> str:
2275+
return self._user_name
2276+
2277+
@user_name.setter
2278+
def user_name(self, user_name: str):
2279+
if user_name is None:
2280+
del self.user_name
2281+
return
2282+
if not isinstance(user_name, str):
2283+
raise TypeError('user_name must be of type str')
2284+
self._user_name = user_name
2285+
2286+
@property
2287+
def review_status(self) -> 'GatingAgreementRequestsReviewStatus':
2288+
return self._review_status
2289+
2290+
@review_status.setter
2291+
def review_status(self, review_status: 'GatingAgreementRequestsReviewStatus'):
2292+
if review_status is None:
2293+
del self.review_status
2294+
return
2295+
if not isinstance(review_status, GatingAgreementRequestsReviewStatus):
2296+
raise TypeError('review_status must be of type GatingAgreementRequestsReviewStatus')
2297+
self._review_status = review_status
2298+
2299+
@property
2300+
def publisher_notes(self) -> str:
2301+
return self._publisher_notes or ""
2302+
2303+
@publisher_notes.setter
2304+
def publisher_notes(self, publisher_notes: str):
2305+
if publisher_notes is None:
2306+
del self.publisher_notes
2307+
return
2308+
if not isinstance(publisher_notes, str):
2309+
raise TypeError('publisher_notes must be of type str')
2310+
self._publisher_notes = publisher_notes
2311+
2312+
def endpoint(self):
2313+
path = '/api/v1/gating/{agreement_id}/user-consent/review'
2314+
return path.format_map(self.to_field_map(self))
2315+
2316+
2317+
@staticmethod
2318+
def method():
2319+
return 'POST'
2320+
2321+
@staticmethod
2322+
def body_fields():
2323+
return '*'
2324+
2325+
22462326
class ApiUpdateModelInstanceRequest(KaggleObject):
22472327
r"""
22482328
Attributes:
@@ -3081,6 +3161,168 @@ def subjectTypesSupported(self):
30813161
return self.subject_types_supported
30823162

30833163

3164+
class ApiGatingUserConsent(KaggleObject):
3165+
r"""
3166+
ApiGatingUserConsent presents GatingUserConsent data for publisher access,
3167+
omitting or modifying certain fields as needed such as user_id.
3168+
3169+
Attributes:
3170+
id (int)
3171+
agreement_id (int)
3172+
user_name (str)
3173+
request_data (str)
3174+
request_time (datetime)
3175+
review_time (datetime)
3176+
review_status (GatingAgreementRequestsReviewStatus)
3177+
expiry_status (GatingAgreementRequestsExpiryStatus)
3178+
expiry_time (datetime)
3179+
publisher_notes (str)
3180+
"""
3181+
3182+
def __init__(self):
3183+
self._id = 0
3184+
self._agreement_id = 0
3185+
self._user_name = ""
3186+
self._request_data = None
3187+
self._request_time = None
3188+
self._review_time = None
3189+
self._review_status = GatingAgreementRequestsReviewStatus.GATING_AGREEMENT_REQUESTS_REVIEW_STATUS_UNSPECIFIED
3190+
self._expiry_status = GatingAgreementRequestsExpiryStatus.GATING_AGREEMENT_REQUESTS_EXPIRY_STATUS_UNSPECIFIED
3191+
self._expiry_time = None
3192+
self._publisher_notes = None
3193+
self._freeze()
3194+
3195+
@property
3196+
def id(self) -> int:
3197+
return self._id
3198+
3199+
@id.setter
3200+
def id(self, id: int):
3201+
if id is None:
3202+
del self.id
3203+
return
3204+
if not isinstance(id, int):
3205+
raise TypeError('id must be of type int')
3206+
self._id = id
3207+
3208+
@property
3209+
def agreement_id(self) -> int:
3210+
return self._agreement_id
3211+
3212+
@agreement_id.setter
3213+
def agreement_id(self, agreement_id: int):
3214+
if agreement_id is None:
3215+
del self.agreement_id
3216+
return
3217+
if not isinstance(agreement_id, int):
3218+
raise TypeError('agreement_id must be of type int')
3219+
self._agreement_id = agreement_id
3220+
3221+
@property
3222+
def user_name(self) -> str:
3223+
return self._user_name
3224+
3225+
@user_name.setter
3226+
def user_name(self, user_name: str):
3227+
if user_name is None:
3228+
del self.user_name
3229+
return
3230+
if not isinstance(user_name, str):
3231+
raise TypeError('user_name must be of type str')
3232+
self._user_name = user_name
3233+
3234+
@property
3235+
def request_data(self) -> str:
3236+
return self._request_data or ""
3237+
3238+
@request_data.setter
3239+
def request_data(self, request_data: str):
3240+
if request_data is None:
3241+
del self.request_data
3242+
return
3243+
if not isinstance(request_data, str):
3244+
raise TypeError('request_data must be of type str')
3245+
self._request_data = request_data
3246+
3247+
@property
3248+
def request_time(self) -> datetime:
3249+
return self._request_time
3250+
3251+
@request_time.setter
3252+
def request_time(self, request_time: datetime):
3253+
if request_time is None:
3254+
del self.request_time
3255+
return
3256+
if not isinstance(request_time, datetime):
3257+
raise TypeError('request_time must be of type datetime')
3258+
self._request_time = request_time
3259+
3260+
@property
3261+
def review_time(self) -> datetime:
3262+
return self._review_time or None
3263+
3264+
@review_time.setter
3265+
def review_time(self, review_time: datetime):
3266+
if review_time is None:
3267+
del self.review_time
3268+
return
3269+
if not isinstance(review_time, datetime):
3270+
raise TypeError('review_time must be of type datetime')
3271+
self._review_time = review_time
3272+
3273+
@property
3274+
def review_status(self) -> 'GatingAgreementRequestsReviewStatus':
3275+
return self._review_status
3276+
3277+
@review_status.setter
3278+
def review_status(self, review_status: 'GatingAgreementRequestsReviewStatus'):
3279+
if review_status is None:
3280+
del self.review_status
3281+
return
3282+
if not isinstance(review_status, GatingAgreementRequestsReviewStatus):
3283+
raise TypeError('review_status must be of type GatingAgreementRequestsReviewStatus')
3284+
self._review_status = review_status
3285+
3286+
@property
3287+
def expiry_status(self) -> 'GatingAgreementRequestsExpiryStatus':
3288+
return self._expiry_status
3289+
3290+
@expiry_status.setter
3291+
def expiry_status(self, expiry_status: 'GatingAgreementRequestsExpiryStatus'):
3292+
if expiry_status is None:
3293+
del self.expiry_status
3294+
return
3295+
if not isinstance(expiry_status, GatingAgreementRequestsExpiryStatus):
3296+
raise TypeError('expiry_status must be of type GatingAgreementRequestsExpiryStatus')
3297+
self._expiry_status = expiry_status
3298+
3299+
@property
3300+
def expiry_time(self) -> datetime:
3301+
return self._expiry_time or None
3302+
3303+
@expiry_time.setter
3304+
def expiry_time(self, expiry_time: datetime):
3305+
if expiry_time is None:
3306+
del self.expiry_time
3307+
return
3308+
if not isinstance(expiry_time, datetime):
3309+
raise TypeError('expiry_time must be of type datetime')
3310+
self._expiry_time = expiry_time
3311+
3312+
@property
3313+
def publisher_notes(self) -> str:
3314+
return self._publisher_notes or ""
3315+
3316+
@publisher_notes.setter
3317+
def publisher_notes(self, publisher_notes: str):
3318+
if publisher_notes is None:
3319+
del self.publisher_notes
3320+
return
3321+
if not isinstance(publisher_notes, str):
3322+
raise TypeError('publisher_notes must be of type str')
3323+
self._publisher_notes = publisher_notes
3324+
3325+
30843326
class JWK(KaggleObject):
30853327
r"""
30863328
Attributes:
@@ -3296,7 +3538,7 @@ def e(self, e: str):
32963538
]
32973539

32983540
ApiListModelGatingUserConsentsResponse._fields = [
3299-
FieldMetadata("gatingUserConsents", "gating_user_consents", "_gating_user_consents", GatingUserConsent, [], ListSerializer(KaggleObjectSerializer())),
3541+
FieldMetadata("gatingUserConsents", "gating_user_consents", "_gating_user_consents", ApiGatingUserConsent, [], ListSerializer(KaggleObjectSerializer())),
33003542
FieldMetadata("totalSize", "total_size", "_total_size", int, 0, PredefinedSerializer()),
33013543
FieldMetadata("nextPageToken", "next_page_token", "_next_page_token", str, "", PredefinedSerializer()),
33023544
]
@@ -3373,6 +3615,13 @@ def e(self, e: str):
33733615
FieldMetadata("totalUncompressedBytes", "total_uncompressed_bytes", "_total_uncompressed_bytes", int, 0, PredefinedSerializer()),
33743616
]
33753617

3618+
ApiReviewGatingUserConsentRequest._fields = [
3619+
FieldMetadata("agreementId", "agreement_id", "_agreement_id", int, 0, PredefinedSerializer()),
3620+
FieldMetadata("userName", "user_name", "_user_name", str, "", PredefinedSerializer()),
3621+
FieldMetadata("reviewStatus", "review_status", "_review_status", GatingAgreementRequestsReviewStatus, GatingAgreementRequestsReviewStatus.GATING_AGREEMENT_REQUESTS_REVIEW_STATUS_UNSPECIFIED, EnumSerializer()),
3622+
FieldMetadata("publisherNotes", "publisher_notes", "_publisher_notes", str, None, PredefinedSerializer(), optional=True),
3623+
]
3624+
33763625
ApiUpdateModelInstanceRequest._fields = [
33773626
FieldMetadata("ownerSlug", "owner_slug", "_owner_slug", str, "", PredefinedSerializer()),
33783627
FieldMetadata("modelSlug", "model_slug", "_model_slug", str, "", PredefinedSerializer()),
@@ -3446,6 +3695,19 @@ def e(self, e: str):
34463695
FieldMetadata("subject_types_supported", "subject_types_supported", "_subject_types_supported", str, [], ListSerializer(PredefinedSerializer())),
34473696
]
34483697

3698+
ApiGatingUserConsent._fields = [
3699+
FieldMetadata("id", "id", "_id", int, 0, PredefinedSerializer()),
3700+
FieldMetadata("agreementId", "agreement_id", "_agreement_id", int, 0, PredefinedSerializer()),
3701+
FieldMetadata("userName", "user_name", "_user_name", str, "", PredefinedSerializer()),
3702+
FieldMetadata("requestData", "request_data", "_request_data", str, None, PredefinedSerializer(), optional=True),
3703+
FieldMetadata("requestTime", "request_time", "_request_time", datetime, None, DateTimeSerializer()),
3704+
FieldMetadata("reviewTime", "review_time", "_review_time", datetime, None, DateTimeSerializer(), optional=True),
3705+
FieldMetadata("reviewStatus", "review_status", "_review_status", GatingAgreementRequestsReviewStatus, GatingAgreementRequestsReviewStatus.GATING_AGREEMENT_REQUESTS_REVIEW_STATUS_UNSPECIFIED, EnumSerializer()),
3706+
FieldMetadata("expiryStatus", "expiry_status", "_expiry_status", GatingAgreementRequestsExpiryStatus, GatingAgreementRequestsExpiryStatus.GATING_AGREEMENT_REQUESTS_EXPIRY_STATUS_UNSPECIFIED, EnumSerializer()),
3707+
FieldMetadata("expiryTime", "expiry_time", "_expiry_time", datetime, None, DateTimeSerializer(), optional=True),
3708+
FieldMetadata("publisherNotes", "publisher_notes", "_publisher_notes", str, None, PredefinedSerializer(), optional=True),
3709+
]
3710+
34493711
JWK._fields = [
34503712
FieldMetadata("kty", "kty", "_kty", str, "", PredefinedSerializer()),
34513713
FieldMetadata("alg", "alg", "_alg", str, "", PredefinedSerializer()),

0 commit comments

Comments
 (0)