From 79adedeffda682f0ec51f2cd449e4c1d1143e875 Mon Sep 17 00:00:00 2001 From: Afiq Hasif Date: Fri, 31 Jan 2025 15:31:41 +0800 Subject: [PATCH] Initial commit --- .github/workflows/python.yml | 38 + .gitignore | 174 ++++ .gitlab-ci.yml | 31 + .travis.yml | 17 + CHANGELOG.md | 11 + CONTRIBUTING.md | 33 + LICENSE | 7 + README.md | 248 ++++++ docs/AcceptOrderRequest.md | 31 + docs/AcceptRejectOrderApi.md | 77 ++ docs/Address.md | 36 + docs/AdvancedPricing.md | 36 + docs/BatchUpdateMenuItem.md | 32 + docs/BatchUpdateMenuResponse.md | 31 + docs/BindMembershipNativeRequest.md | 31 + docs/BindMembershipNativeResponse.md | 30 + docs/Campaign.md | 37 + docs/CampaignConditions.md | 35 + docs/CampaignDiscount.md | 33 + docs/CampaignQuotas.md | 31 + docs/CampaignScope.md | 31 + docs/CancelCode.md | 17 + docs/CancelOrderApi.md | 85 ++ docs/CancelOrderLimitType.md | 19 + docs/CancelOrderRequest.md | 32 + docs/CancelOrderResponse.md | 31 + docs/CancelReason.md | 30 + docs/CheckOrderCancelableApi.md | 79 ++ docs/CheckOrderCancelableResponse.md | 34 + docs/Coordinates.md | 31 + docs/CreateCampaignApi.md | 81 ++ docs/CreateCampaignRequest.md | 35 + docs/CreateCampaignResponse.md | 30 + docs/CreateSelfServeJourneyApi.md | 80 ++ docs/CreateSelfServeJourneyRequest.md | 30 + docs/CreateSelfServeJourneyRequestPartner.md | 30 + docs/CreateSelfServeJourneyResponse.md | 30 + docs/Currency.md | 32 + docs/DeleteCampaignApi.md | 74 ++ docs/DineIn.md | 31 + docs/EditOrderApi.md | 80 ++ docs/EditOrderItem.md | 32 + docs/EditOrderRequest.md | 32 + docs/Error.md | 31 + docs/GetDineInVoucherResponse.md | 35 + docs/GetDineinVoucherApi.md | 83 ++ docs/GetMembershipNativeResponse.md | 32 + docs/GetMembershipNativeResponsePointInfo.md | 32 + docs/GetMembershipRequest.md | 30 + docs/GetMembershipWebviewResponse.md | 30 + docs/GetMenuNewResponse.md | 34 + docs/GetMenuOldResponse.md | 33 + docs/GetOauthGrabApi.md | 78 ++ docs/GetRewardNativeRequest.md | 33 + docs/GetRewardNativeResponse.md | 30 + docs/GetStoreHourApi.md | 79 ++ docs/GetStoreStatusApi.md | 79 ++ docs/GrabOauthRequest.md | 33 + docs/GrabOauthResponse.md | 31 + docs/ListCampaignApi.md | 77 ++ docs/ListCampaignResponse.md | 31 + docs/ListOrdersApi.md | 81 ++ docs/ListOrdersResponse.md | 31 + docs/MarkOrderReadyApi.md | 78 ++ docs/MarkOrderRequest.md | 31 + docs/MenuCategory.md | 35 + docs/MenuEntity.md | 34 + docs/MenuEntityError.md | 30 + docs/MenuItem.md | 45 + docs/MenuModifier.md | 36 + docs/MenuSection.md | 32 + docs/MenuSectionCategory.md | 33 + docs/MenuSectionCategoryItem.md | 43 + docs/MenuSyncFail.md | 32 + docs/MenuSyncFailCategory.md | 31 + docs/MenuSyncFailItem.md | 31 + docs/MenuSyncFailModifier.md | 30 + docs/MenuSyncFailModifierGroup.md | 31 + docs/MenuSyncFailServiceHours.md | 29 + docs/MenuSyncResponse.md | 34 + docs/MenuSyncWebhookRequest.md | 36 + docs/ModifierGroup.md | 36 + docs/NewOrderTimeRequest.md | 31 + docs/NotifyMembershipWebviewApi.md | 78 ++ docs/NotifyMembershipWebviewRequest.md | 33 + docs/OpenPeriod.md | 30 + docs/Order.md | 50 ++ docs/OrderCampaign.md | 39 + docs/OrderDeliveryRequest.md | 32 + docs/OrderFeatureFlags.md | 32 + docs/OrderFreeItem.md | 33 + docs/OrderItem.md | 36 + docs/OrderItemModifier.md | 32 + docs/OrderPrice.md | 38 + docs/OrderPromo.md | 36 + docs/OrderReadyEstimation.md | 33 + docs/OrderStateRequest.md | 36 + docs/OutOfStockInstruction.md | 33 + docs/PartnerOauthRequest.md | 33 + docs/PartnerOauthResponse.md | 31 + docs/PauseStoreApi.md | 77 ++ docs/PauseStoreRequest.md | 32 + docs/Purchasability.md | 36 + docs/PushIntegrationStatusWebhookRequest.md | 32 + docs/Receiver.md | 32 + docs/RedeemDineInVoucherRequest.md | 31 + docs/RedeemDineInVoucherResponse.md | 35 + docs/RedeemDineinVoucherApi.md | 83 ++ docs/RedeemResult.md | 31 + docs/RegisterMembershipNativeRequest.md | 33 + docs/RegisterMembershipNativeResponse.md | 30 + docs/RewardItem.md | 30 + docs/SellingTime.md | 33 + docs/ServiceHour.md | 31 + docs/ServiceHours.md | 36 + docs/SpecialOpeningHour.md | 32 + docs/SpecialOpeningHourMetadata.md | 30 + docs/SpecialOpeningHourOpeningHours.md | 31 + docs/StoreHour.md | 36 + docs/StoreHourResponse.md | 32 + docs/StoreStatusResponse.md | 32 + docs/SubmitOrderRequest.md | 50 ++ docs/TraceMenuSyncApi.md | 78 ++ docs/UnbindMembershipNativeRequest.md | 30 + docs/UnlinkMembershipWebviewRequest.md | 30 + docs/UpdateAdvancedPricing.md | 30 + docs/UpdateCampaignApi.md | 79 ++ docs/UpdateCampaignRequest.md | 35 + docs/UpdateDeliveryHourRequest.md | 31 + docs/UpdateDeliveryHourResponse.md | 33 + docs/UpdateDeliveryStateApi.md | 77 ++ docs/UpdateDineInHourRequest.md | 30 + docs/UpdateDineInHourResponse.md | 30 + docs/UpdateMenuItem.md | 37 + docs/UpdateMenuModifier.md | 37 + docs/UpdateMenuNotifRequest.md | 30 + docs/UpdateMenuNotificationApi.md | 78 ++ docs/UpdateMenuRecordApi.md | 152 ++++ docs/UpdateMenuRequest.md | 38 + docs/UpdateOrderReadyTimeApi.md | 78 ++ docs/UpdatePurchasability.md | 30 + docs/UpdateSpecialHourRequest.md | 30 + docs/UpdateSpecialHourResponse.md | 33 + docs/UpdateStoreDeliveryHourApi.md | 84 ++ docs/UpdateStoreDineInHourApi.md | 84 ++ docs/UpdateStoreSpecialHourApi.md | 84 ++ docs/Voucher.md | 34 + docs/VoucherDescriptionInfo.md | 30 + docs/WorkingHour.md | 36 + docs/WorkingHourDay.md | 30 + grabfood/__init__.py | 182 ++++ grabfood/api/__init__.py | 30 + grabfood/api/accept_reject_order_api.py | 331 ++++++++ grabfood/api/cancel_order_api.py | 354 ++++++++ grabfood/api/check_order_cancelable_api.py | 329 +++++++ grabfood/api/create_campaign_api.py | 342 ++++++++ grabfood/api/create_self_serve_journey_api.py | 339 ++++++++ grabfood/api/delete_campaign_api.py | 302 +++++++ grabfood/api/edit_order_api.py | 356 ++++++++ grabfood/api/get_dinein_voucher_api.py | 353 ++++++++ grabfood/api/get_oauth_grab_api.py | 328 +++++++ grabfood/api/get_store_hour_api.py | 316 +++++++ grabfood/api/get_store_status_api.py | 316 +++++++ grabfood/api/list_campaign_api.py | 312 +++++++ grabfood/api/list_orders_api.py | 346 ++++++++ grabfood/api/mark_order_ready_api.py | 341 ++++++++ grabfood/api/notify_membership_webview_api.py | 334 ++++++++ grabfood/api/pause_store_api.py | 331 ++++++++ grabfood/api/redeem_dinein_voucher_api.py | 348 ++++++++ grabfood/api/trace_menu_sync_api.py | 315 +++++++ grabfood/api/update_campaign_api.py | 346 ++++++++ grabfood/api/update_delivery_state_api.py | 331 ++++++++ grabfood/api/update_menu_notification_api.py | 341 ++++++++ grabfood/api/update_menu_record_api.py | 640 ++++++++++++++ grabfood/api/update_order_ready_time_api.py | 341 ++++++++ .../api/update_store_delivery_hour_api.py | 360 ++++++++ grabfood/api/update_store_dine_in_hour_api.py | 360 ++++++++ grabfood/api/update_store_special_hour_api.py | 360 ++++++++ grabfood/api_client.py | 802 ++++++++++++++++++ grabfood/api_response.py | 21 + grabfood/configs/__init__.py | 6 + grabfood/configs/config.py | 4 + grabfood/configuration.py | 456 ++++++++++ grabfood/exceptions.py | 201 +++++ grabfood/models/__init__.py | 134 +++ grabfood/models/accept_order_request.py | 111 +++ grabfood/models/address.py | 128 +++ grabfood/models/advanced_pricing.py | 114 +++ grabfood/models/batch_update_menu_item.py | 121 +++ grabfood/models/batch_update_menu_response.py | 129 +++ .../models/bind_membership_native_request.py | 104 +++ .../models/bind_membership_native_response.py | 102 +++ grabfood/models/campaign.py | 136 +++ grabfood/models/campaign_conditions.py | 124 +++ grabfood/models/campaign_discount.py | 119 +++ grabfood/models/campaign_quotas.py | 104 +++ grabfood/models/campaign_scope.py | 111 +++ grabfood/models/cancel_code.py | 41 + grabfood/models/cancel_order_limit_type.py | 42 + grabfood/models/cancel_order_request.py | 107 +++ grabfood/models/cancel_order_response.py | 105 +++ grabfood/models/cancel_reason.py | 105 +++ .../models/check_order_cancelable_response.py | 129 +++ grabfood/models/coordinates.py | 104 +++ grabfood/models/create_campaign_request.py | 125 +++ grabfood/models/create_campaign_response.py | 102 +++ .../create_self_serve_journey_request.py | 106 +++ ...eate_self_serve_journey_request_partner.py | 102 +++ .../create_self_serve_journey_response.py | 102 +++ grabfood/models/currency.py | 121 +++ grabfood/models/dine_in.py | 104 +++ grabfood/models/edit_order_item.py | 115 +++ grabfood/models/edit_order_request.py | 114 +++ grabfood/models/error.py | 106 +++ .../models/get_dine_in_voucher_response.py | 127 +++ .../models/get_membership_native_response.py | 120 +++ ...t_membership_native_response_point_info.py | 106 +++ grabfood/models/get_membership_request.py | 102 +++ .../models/get_membership_webview_response.py | 112 +++ grabfood/models/get_menu_new_response.py | 130 +++ grabfood/models/get_menu_old_response.py | 120 +++ grabfood/models/get_reward_native_request.py | 116 +++ grabfood/models/get_reward_native_response.py | 102 +++ grabfood/models/grab_oauth_request.py | 109 +++ grabfood/models/grab_oauth_response.py | 106 +++ grabfood/models/list_campaign_response.py | 119 +++ grabfood/models/list_orders_response.py | 112 +++ grabfood/models/mark_order_request.py | 111 +++ grabfood/models/menu_category.py | 130 +++ grabfood/models/menu_entity.py | 138 +++ grabfood/models/menu_entity_error.py | 104 +++ grabfood/models/menu_item.py | 168 ++++ grabfood/models/menu_modifier.py | 128 +++ grabfood/models/menu_section.py | 121 +++ grabfood/models/menu_section_category.py | 126 +++ grabfood/models/menu_section_category_item.py | 164 ++++ grabfood/models/menu_sync_fail.py | 120 +++ grabfood/models/menu_sync_fail_category.py | 115 +++ grabfood/models/menu_sync_fail_item.py | 115 +++ grabfood/models/menu_sync_fail_modifier.py | 104 +++ .../models/menu_sync_fail_modifier_group.py | 114 +++ .../models/menu_sync_fail_service_hours.py | 102 +++ grabfood/models/menu_sync_response.py | 136 +++ grabfood/models/menu_sync_webhook_request.py | 124 +++ grabfood/models/modifier_group.py | 132 +++ grabfood/models/new_order_time_request.py | 105 +++ .../notify_membership_webview_request.py | 118 +++ grabfood/models/open_period.py | 104 +++ grabfood/models/order.py | 218 +++++ grabfood/models/order_campaign.py | 162 ++++ grabfood/models/order_delivery_request.py | 120 +++ grabfood/models/order_feature_flags.py | 120 +++ grabfood/models/order_free_item.py | 108 +++ grabfood/models/order_item.py | 134 +++ grabfood/models/order_item_modifier.py | 119 +++ grabfood/models/order_price.py | 118 +++ grabfood/models/order_promo.py | 116 +++ grabfood/models/order_ready_estimation.py | 114 +++ grabfood/models/order_state_request.py | 126 +++ grabfood/models/out_of_stock_instruction.py | 118 +++ grabfood/models/partner_oauth_request.py | 109 +++ grabfood/models/partner_oauth_response.py | 116 +++ grabfood/models/pause_store_request.py | 116 +++ grabfood/models/purchasability.py | 114 +++ ...push_integration_status_webhook_request.py | 113 +++ grabfood/models/receiver.py | 111 +++ .../models/redeem_dine_in_voucher_request.py | 104 +++ .../models/redeem_dine_in_voucher_response.py | 121 +++ grabfood/models/redeem_result.py | 114 +++ .../register_membership_native_request.py | 108 +++ .../register_membership_native_response.py | 102 +++ grabfood/models/reward_item.py | 104 +++ grabfood/models/selling_time.py | 115 +++ grabfood/models/service_hour.py | 119 +++ grabfood/models/service_hours.py | 136 +++ grabfood/models/special_opening_hour.py | 116 +++ .../models/special_opening_hour_metadata.py | 102 +++ .../special_opening_hour_opening_hours.py | 122 +++ grabfood/models/store_hour.py | 164 ++++ grabfood/models/store_hour_response.py | 121 +++ grabfood/models/store_status_response.py | 113 +++ grabfood/models/submit_order_request.py | 218 +++++ .../unbind_membership_native_request.py | 102 +++ .../unlink_membership_webview_request.py | 102 +++ grabfood/models/update_advanced_pricing.py | 114 +++ grabfood/models/update_campaign_request.py | 125 +++ .../models/update_delivery_hour_request.py | 108 +++ .../models/update_delivery_hour_response.py | 124 +++ .../models/update_dine_in_hour_request.py | 106 +++ .../models/update_dine_in_hour_response.py | 107 +++ grabfood/models/update_menu_item.py | 149 ++++ grabfood/models/update_menu_modifier.py | 141 +++ grabfood/models/update_menu_notif_request.py | 102 +++ grabfood/models/update_menu_request.py | 139 +++ grabfood/models/update_purchasability.py | 114 +++ .../models/update_special_hour_request.py | 110 +++ .../models/update_special_hour_response.py | 124 +++ grabfood/models/voucher.py | 124 +++ grabfood/models/voucher_description_info.py | 102 +++ grabfood/models/working_hour.py | 136 +++ grabfood/models/working_hour_day.py | 115 +++ grabfood/py.typed | 0 grabfood/rest.py | 271 ++++++ pyproject.toml | 71 ++ requirements.txt | 5 + setup.cfg | 2 + setup.py | 51 ++ test-requirements.txt | 5 + tox.ini | 9 + 309 files changed, 31484 insertions(+) create mode 100644 .github/workflows/python.yml create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 .travis.yml create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 docs/AcceptOrderRequest.md create mode 100644 docs/AcceptRejectOrderApi.md create mode 100644 docs/Address.md create mode 100644 docs/AdvancedPricing.md create mode 100644 docs/BatchUpdateMenuItem.md create mode 100644 docs/BatchUpdateMenuResponse.md create mode 100644 docs/BindMembershipNativeRequest.md create mode 100644 docs/BindMembershipNativeResponse.md create mode 100644 docs/Campaign.md create mode 100644 docs/CampaignConditions.md create mode 100644 docs/CampaignDiscount.md create mode 100644 docs/CampaignQuotas.md create mode 100644 docs/CampaignScope.md create mode 100644 docs/CancelCode.md create mode 100644 docs/CancelOrderApi.md create mode 100644 docs/CancelOrderLimitType.md create mode 100644 docs/CancelOrderRequest.md create mode 100644 docs/CancelOrderResponse.md create mode 100644 docs/CancelReason.md create mode 100644 docs/CheckOrderCancelableApi.md create mode 100644 docs/CheckOrderCancelableResponse.md create mode 100644 docs/Coordinates.md create mode 100644 docs/CreateCampaignApi.md create mode 100644 docs/CreateCampaignRequest.md create mode 100644 docs/CreateCampaignResponse.md create mode 100644 docs/CreateSelfServeJourneyApi.md create mode 100644 docs/CreateSelfServeJourneyRequest.md create mode 100644 docs/CreateSelfServeJourneyRequestPartner.md create mode 100644 docs/CreateSelfServeJourneyResponse.md create mode 100644 docs/Currency.md create mode 100644 docs/DeleteCampaignApi.md create mode 100644 docs/DineIn.md create mode 100644 docs/EditOrderApi.md create mode 100644 docs/EditOrderItem.md create mode 100644 docs/EditOrderRequest.md create mode 100644 docs/Error.md create mode 100644 docs/GetDineInVoucherResponse.md create mode 100644 docs/GetDineinVoucherApi.md create mode 100644 docs/GetMembershipNativeResponse.md create mode 100644 docs/GetMembershipNativeResponsePointInfo.md create mode 100644 docs/GetMembershipRequest.md create mode 100644 docs/GetMembershipWebviewResponse.md create mode 100644 docs/GetMenuNewResponse.md create mode 100644 docs/GetMenuOldResponse.md create mode 100644 docs/GetOauthGrabApi.md create mode 100644 docs/GetRewardNativeRequest.md create mode 100644 docs/GetRewardNativeResponse.md create mode 100644 docs/GetStoreHourApi.md create mode 100644 docs/GetStoreStatusApi.md create mode 100644 docs/GrabOauthRequest.md create mode 100644 docs/GrabOauthResponse.md create mode 100644 docs/ListCampaignApi.md create mode 100644 docs/ListCampaignResponse.md create mode 100644 docs/ListOrdersApi.md create mode 100644 docs/ListOrdersResponse.md create mode 100644 docs/MarkOrderReadyApi.md create mode 100644 docs/MarkOrderRequest.md create mode 100644 docs/MenuCategory.md create mode 100644 docs/MenuEntity.md create mode 100644 docs/MenuEntityError.md create mode 100644 docs/MenuItem.md create mode 100644 docs/MenuModifier.md create mode 100644 docs/MenuSection.md create mode 100644 docs/MenuSectionCategory.md create mode 100644 docs/MenuSectionCategoryItem.md create mode 100644 docs/MenuSyncFail.md create mode 100644 docs/MenuSyncFailCategory.md create mode 100644 docs/MenuSyncFailItem.md create mode 100644 docs/MenuSyncFailModifier.md create mode 100644 docs/MenuSyncFailModifierGroup.md create mode 100644 docs/MenuSyncFailServiceHours.md create mode 100644 docs/MenuSyncResponse.md create mode 100644 docs/MenuSyncWebhookRequest.md create mode 100644 docs/ModifierGroup.md create mode 100644 docs/NewOrderTimeRequest.md create mode 100644 docs/NotifyMembershipWebviewApi.md create mode 100644 docs/NotifyMembershipWebviewRequest.md create mode 100644 docs/OpenPeriod.md create mode 100644 docs/Order.md create mode 100644 docs/OrderCampaign.md create mode 100644 docs/OrderDeliveryRequest.md create mode 100644 docs/OrderFeatureFlags.md create mode 100644 docs/OrderFreeItem.md create mode 100644 docs/OrderItem.md create mode 100644 docs/OrderItemModifier.md create mode 100644 docs/OrderPrice.md create mode 100644 docs/OrderPromo.md create mode 100644 docs/OrderReadyEstimation.md create mode 100644 docs/OrderStateRequest.md create mode 100644 docs/OutOfStockInstruction.md create mode 100644 docs/PartnerOauthRequest.md create mode 100644 docs/PartnerOauthResponse.md create mode 100644 docs/PauseStoreApi.md create mode 100644 docs/PauseStoreRequest.md create mode 100644 docs/Purchasability.md create mode 100644 docs/PushIntegrationStatusWebhookRequest.md create mode 100644 docs/Receiver.md create mode 100644 docs/RedeemDineInVoucherRequest.md create mode 100644 docs/RedeemDineInVoucherResponse.md create mode 100644 docs/RedeemDineinVoucherApi.md create mode 100644 docs/RedeemResult.md create mode 100644 docs/RegisterMembershipNativeRequest.md create mode 100644 docs/RegisterMembershipNativeResponse.md create mode 100644 docs/RewardItem.md create mode 100644 docs/SellingTime.md create mode 100644 docs/ServiceHour.md create mode 100644 docs/ServiceHours.md create mode 100644 docs/SpecialOpeningHour.md create mode 100644 docs/SpecialOpeningHourMetadata.md create mode 100644 docs/SpecialOpeningHourOpeningHours.md create mode 100644 docs/StoreHour.md create mode 100644 docs/StoreHourResponse.md create mode 100644 docs/StoreStatusResponse.md create mode 100644 docs/SubmitOrderRequest.md create mode 100644 docs/TraceMenuSyncApi.md create mode 100644 docs/UnbindMembershipNativeRequest.md create mode 100644 docs/UnlinkMembershipWebviewRequest.md create mode 100644 docs/UpdateAdvancedPricing.md create mode 100644 docs/UpdateCampaignApi.md create mode 100644 docs/UpdateCampaignRequest.md create mode 100644 docs/UpdateDeliveryHourRequest.md create mode 100644 docs/UpdateDeliveryHourResponse.md create mode 100644 docs/UpdateDeliveryStateApi.md create mode 100644 docs/UpdateDineInHourRequest.md create mode 100644 docs/UpdateDineInHourResponse.md create mode 100644 docs/UpdateMenuItem.md create mode 100644 docs/UpdateMenuModifier.md create mode 100644 docs/UpdateMenuNotifRequest.md create mode 100644 docs/UpdateMenuNotificationApi.md create mode 100644 docs/UpdateMenuRecordApi.md create mode 100644 docs/UpdateMenuRequest.md create mode 100644 docs/UpdateOrderReadyTimeApi.md create mode 100644 docs/UpdatePurchasability.md create mode 100644 docs/UpdateSpecialHourRequest.md create mode 100644 docs/UpdateSpecialHourResponse.md create mode 100644 docs/UpdateStoreDeliveryHourApi.md create mode 100644 docs/UpdateStoreDineInHourApi.md create mode 100644 docs/UpdateStoreSpecialHourApi.md create mode 100644 docs/Voucher.md create mode 100644 docs/VoucherDescriptionInfo.md create mode 100644 docs/WorkingHour.md create mode 100644 docs/WorkingHourDay.md create mode 100644 grabfood/__init__.py create mode 100644 grabfood/api/__init__.py create mode 100644 grabfood/api/accept_reject_order_api.py create mode 100644 grabfood/api/cancel_order_api.py create mode 100644 grabfood/api/check_order_cancelable_api.py create mode 100644 grabfood/api/create_campaign_api.py create mode 100644 grabfood/api/create_self_serve_journey_api.py create mode 100644 grabfood/api/delete_campaign_api.py create mode 100644 grabfood/api/edit_order_api.py create mode 100644 grabfood/api/get_dinein_voucher_api.py create mode 100644 grabfood/api/get_oauth_grab_api.py create mode 100644 grabfood/api/get_store_hour_api.py create mode 100644 grabfood/api/get_store_status_api.py create mode 100644 grabfood/api/list_campaign_api.py create mode 100644 grabfood/api/list_orders_api.py create mode 100644 grabfood/api/mark_order_ready_api.py create mode 100644 grabfood/api/notify_membership_webview_api.py create mode 100644 grabfood/api/pause_store_api.py create mode 100644 grabfood/api/redeem_dinein_voucher_api.py create mode 100644 grabfood/api/trace_menu_sync_api.py create mode 100644 grabfood/api/update_campaign_api.py create mode 100644 grabfood/api/update_delivery_state_api.py create mode 100644 grabfood/api/update_menu_notification_api.py create mode 100644 grabfood/api/update_menu_record_api.py create mode 100644 grabfood/api/update_order_ready_time_api.py create mode 100644 grabfood/api/update_store_delivery_hour_api.py create mode 100644 grabfood/api/update_store_dine_in_hour_api.py create mode 100644 grabfood/api/update_store_special_hour_api.py create mode 100644 grabfood/api_client.py create mode 100644 grabfood/api_response.py create mode 100644 grabfood/configs/__init__.py create mode 100644 grabfood/configs/config.py create mode 100644 grabfood/configuration.py create mode 100644 grabfood/exceptions.py create mode 100644 grabfood/models/__init__.py create mode 100644 grabfood/models/accept_order_request.py create mode 100644 grabfood/models/address.py create mode 100644 grabfood/models/advanced_pricing.py create mode 100644 grabfood/models/batch_update_menu_item.py create mode 100644 grabfood/models/batch_update_menu_response.py create mode 100644 grabfood/models/bind_membership_native_request.py create mode 100644 grabfood/models/bind_membership_native_response.py create mode 100644 grabfood/models/campaign.py create mode 100644 grabfood/models/campaign_conditions.py create mode 100644 grabfood/models/campaign_discount.py create mode 100644 grabfood/models/campaign_quotas.py create mode 100644 grabfood/models/campaign_scope.py create mode 100644 grabfood/models/cancel_code.py create mode 100644 grabfood/models/cancel_order_limit_type.py create mode 100644 grabfood/models/cancel_order_request.py create mode 100644 grabfood/models/cancel_order_response.py create mode 100644 grabfood/models/cancel_reason.py create mode 100644 grabfood/models/check_order_cancelable_response.py create mode 100644 grabfood/models/coordinates.py create mode 100644 grabfood/models/create_campaign_request.py create mode 100644 grabfood/models/create_campaign_response.py create mode 100644 grabfood/models/create_self_serve_journey_request.py create mode 100644 grabfood/models/create_self_serve_journey_request_partner.py create mode 100644 grabfood/models/create_self_serve_journey_response.py create mode 100644 grabfood/models/currency.py create mode 100644 grabfood/models/dine_in.py create mode 100644 grabfood/models/edit_order_item.py create mode 100644 grabfood/models/edit_order_request.py create mode 100644 grabfood/models/error.py create mode 100644 grabfood/models/get_dine_in_voucher_response.py create mode 100644 grabfood/models/get_membership_native_response.py create mode 100644 grabfood/models/get_membership_native_response_point_info.py create mode 100644 grabfood/models/get_membership_request.py create mode 100644 grabfood/models/get_membership_webview_response.py create mode 100644 grabfood/models/get_menu_new_response.py create mode 100644 grabfood/models/get_menu_old_response.py create mode 100644 grabfood/models/get_reward_native_request.py create mode 100644 grabfood/models/get_reward_native_response.py create mode 100644 grabfood/models/grab_oauth_request.py create mode 100644 grabfood/models/grab_oauth_response.py create mode 100644 grabfood/models/list_campaign_response.py create mode 100644 grabfood/models/list_orders_response.py create mode 100644 grabfood/models/mark_order_request.py create mode 100644 grabfood/models/menu_category.py create mode 100644 grabfood/models/menu_entity.py create mode 100644 grabfood/models/menu_entity_error.py create mode 100644 grabfood/models/menu_item.py create mode 100644 grabfood/models/menu_modifier.py create mode 100644 grabfood/models/menu_section.py create mode 100644 grabfood/models/menu_section_category.py create mode 100644 grabfood/models/menu_section_category_item.py create mode 100644 grabfood/models/menu_sync_fail.py create mode 100644 grabfood/models/menu_sync_fail_category.py create mode 100644 grabfood/models/menu_sync_fail_item.py create mode 100644 grabfood/models/menu_sync_fail_modifier.py create mode 100644 grabfood/models/menu_sync_fail_modifier_group.py create mode 100644 grabfood/models/menu_sync_fail_service_hours.py create mode 100644 grabfood/models/menu_sync_response.py create mode 100644 grabfood/models/menu_sync_webhook_request.py create mode 100644 grabfood/models/modifier_group.py create mode 100644 grabfood/models/new_order_time_request.py create mode 100644 grabfood/models/notify_membership_webview_request.py create mode 100644 grabfood/models/open_period.py create mode 100644 grabfood/models/order.py create mode 100644 grabfood/models/order_campaign.py create mode 100644 grabfood/models/order_delivery_request.py create mode 100644 grabfood/models/order_feature_flags.py create mode 100644 grabfood/models/order_free_item.py create mode 100644 grabfood/models/order_item.py create mode 100644 grabfood/models/order_item_modifier.py create mode 100644 grabfood/models/order_price.py create mode 100644 grabfood/models/order_promo.py create mode 100644 grabfood/models/order_ready_estimation.py create mode 100644 grabfood/models/order_state_request.py create mode 100644 grabfood/models/out_of_stock_instruction.py create mode 100644 grabfood/models/partner_oauth_request.py create mode 100644 grabfood/models/partner_oauth_response.py create mode 100644 grabfood/models/pause_store_request.py create mode 100644 grabfood/models/purchasability.py create mode 100644 grabfood/models/push_integration_status_webhook_request.py create mode 100644 grabfood/models/receiver.py create mode 100644 grabfood/models/redeem_dine_in_voucher_request.py create mode 100644 grabfood/models/redeem_dine_in_voucher_response.py create mode 100644 grabfood/models/redeem_result.py create mode 100644 grabfood/models/register_membership_native_request.py create mode 100644 grabfood/models/register_membership_native_response.py create mode 100644 grabfood/models/reward_item.py create mode 100644 grabfood/models/selling_time.py create mode 100644 grabfood/models/service_hour.py create mode 100644 grabfood/models/service_hours.py create mode 100644 grabfood/models/special_opening_hour.py create mode 100644 grabfood/models/special_opening_hour_metadata.py create mode 100644 grabfood/models/special_opening_hour_opening_hours.py create mode 100644 grabfood/models/store_hour.py create mode 100644 grabfood/models/store_hour_response.py create mode 100644 grabfood/models/store_status_response.py create mode 100644 grabfood/models/submit_order_request.py create mode 100644 grabfood/models/unbind_membership_native_request.py create mode 100644 grabfood/models/unlink_membership_webview_request.py create mode 100644 grabfood/models/update_advanced_pricing.py create mode 100644 grabfood/models/update_campaign_request.py create mode 100644 grabfood/models/update_delivery_hour_request.py create mode 100644 grabfood/models/update_delivery_hour_response.py create mode 100644 grabfood/models/update_dine_in_hour_request.py create mode 100644 grabfood/models/update_dine_in_hour_response.py create mode 100644 grabfood/models/update_menu_item.py create mode 100644 grabfood/models/update_menu_modifier.py create mode 100644 grabfood/models/update_menu_notif_request.py create mode 100644 grabfood/models/update_menu_request.py create mode 100644 grabfood/models/update_purchasability.py create mode 100644 grabfood/models/update_special_hour_request.py create mode 100644 grabfood/models/update_special_hour_response.py create mode 100644 grabfood/models/voucher.py create mode 100644 grabfood/models/voucher_description_info.py create mode 100644 grabfood/models/working_hour.py create mode 100644 grabfood/models/working_hour_day.py create mode 100644 grabfood/py.typed create mode 100644 grabfood/rest.py create mode 100644 pyproject.toml create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 0000000..7d43efa --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,38 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: grabfood Python package + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bb15000 --- /dev/null +++ b/.gitignore @@ -0,0 +1,174 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# UV +# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +#uv.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +# PyPI configuration file +.pypirc + +.DS_Store +git_push.sh \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..c64737a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,31 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.gitlab.com/ee/ci/README.html +# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml + +stages: + - test + +.pytest: + stage: test + script: + - pip install -r requirements.txt + - pip install -r test-requirements.txt + - pytest --cov=grabfood + +pytest-3.7: + extends: .pytest + image: python:3.7-alpine +pytest-3.8: + extends: .pytest + image: python:3.8-alpine +pytest-3.9: + extends: .pytest + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1f2fa72 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + # uncomment the following if needed + #- "3.11-dev" # 3.11 development branch + #- "nightly" # nightly build +# command to install dependencies +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" +# command to run tests +script: pytest --cov=grabfood diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..715f5a7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +## [1.0.1] - 2025-01-25 + +### Added + +- Initial release of the project. + +### Changed + +### Deprecated diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b291156 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,33 @@ +# Contributing to Our Project's SDK + +We value your input and contributions! We use the [OpenAPI Generator tool](https://openapi-generator.tech) to generate our SDK based on an OpenAPI YAML specification. + +If you find an issue with our SDK and want to contribute a fix, follow the guidelines mentioned below: + +## Reporting an Issue + +1. Notice an issue while using the SDK? Try to determine what's causing it. Was it a particular endpoint, operation, or datatype? + +2. Check the YAML specification: Once you've identified the issue, refer to the corresponding definition in the OpenAPI YAML specification file that is included in the SDK. This could be a specific path, operation, parameter, or schema. + +3. Describe the current behavior and desired correct behavior. + +4. Describe the steps to reproduce this issue. + +Please note that due to our open-source process, we don't have a direct way to accept code contributions for the SDK. The SDK is directly generated from our OpenAPI YAML specification file. Hence, you don't need to manually update the SDK. Instead, identify the modifications needed in the OpenAPI YAML specification. + +## Submitting a Suggestion + +If there's something in the SDK that isn't broken but could be better, you're welcome to share suggestions. Constructive feedback is always appreciated! + +When submitting a suggestion: + +1. Be clear and concise in your description of the suggestion. + +2. Explain why it would be beneficial. Real-life examples, if applicable, can help to illustrate your point. + +3. Be patient. Not all suggestions can be incorporated immediately, and it may be necessary for us to research your idea before we can implement it. + +Remember, contributions come in many forms, not just in code! Identifying areas for improvement or bringing up issues helps us make the SDK better for everyone. + +Thank you for your contributions! \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8096d9f --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2024 Grabtaxi Holdings PTE LTE (GRAB) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..fbfa446 --- /dev/null +++ b/README.md @@ -0,0 +1,248 @@ +# grabfood +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.1.3 +- Package version: 1.0.1 +- Generator version: 7.8.0 +- Build package: org.openapitools.codegen.languages.PythonClientCodegen +For more information, please visit [https://developer.grab.com](https://developer.grab.com) + +## Requirements. + +Python 3.7+ + +## Installation & Usage +### pip install + +If the python package is hosted on a repository, you can install directly using: + +```sh +pip install git+https://github.com/grab/grabfood-api-sdk-python.git +``` +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/grab/grabfood-api-sdk-python.git`) + +Then import the package: +```python +import grabfood +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import grabfood +``` + +### Tests + +Execute `pytest` to run the tests. + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python + +import grabfood +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.AcceptRejectOrderApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + accept_order_request = grabfood.AcceptOrderRequest() # AcceptOrderRequest | + + try: + # Manually accept/reject orders + api_instance.accept_reject_order(authorization, content_type, accept_order_request) + except ApiException as e: + print("Exception when calling AcceptRejectOrderApi->accept_reject_order: %s\n" % e) + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AcceptRejectOrderApi* | [**accept_reject_order**](docs/AcceptRejectOrderApi.md#accept_reject_order) | **POST** /partner/v1/order/prepare | Manually accept/reject orders +*CancelOrderApi* | [**cancel_order**](docs/CancelOrderApi.md#cancel_order) | **PUT** /partner/v1/order/cancel | Cancel an order +*CheckOrderCancelableApi* | [**check_order_cancelable**](docs/CheckOrderCancelableApi.md#check_order_cancelable) | **GET** /partner/v1/order/cancelable | Check order cancelable +*CreateCampaignApi* | [**create_campaign**](docs/CreateCampaignApi.md#create_campaign) | **POST** /partner/v1/campaigns | Create campaign +*CreateSelfServeJourneyApi* | [**create_self_serve_journey**](docs/CreateSelfServeJourneyApi.md#create_self_serve_journey) | **POST** /partner/v1/self-serve/activation | Create self serve journey +*DeleteCampaignApi* | [**delete_campaign**](docs/DeleteCampaignApi.md#delete_campaign) | **DELETE** /partner/v1/campaigns/{campaign_id} | Delete campaigns +*EditOrderApi* | [**edit_order**](docs/EditOrderApi.md#edit_order) | **PUT** /partner/v1/orders/{orderID} | Edit Order +*GetDineinVoucherApi* | [**get_dinein_voucher**](docs/GetDineinVoucherApi.md#get_dinein_voucher) | **GET** /partner/v1/dinein/voucher | Get Dine In Voucher +*GetOauthGrabApi* | [**get_oauth_grab**](docs/GetOauthGrabApi.md#get_oauth_grab) | **POST** /grabid/v1/oauth2/token | Get Oauth access token +*GetStoreHourApi* | [**get_store_hour**](docs/GetStoreHourApi.md#get_store_hour) | **GET** /partner/v2/merchants/{merchantID}/store/hours | Get Store Hours +*GetStoreStatusApi* | [**get_store_status**](docs/GetStoreStatusApi.md#get_store_status) | **GET** /partner/v1/merchants/{merchantID}/store/status | Get Store Status +*ListCampaignApi* | [**list_campaign**](docs/ListCampaignApi.md#list_campaign) | **GET** /partner/v1/campaigns | List campaigns +*ListOrdersApi* | [**list_orders**](docs/ListOrdersApi.md#list_orders) | **GET** /partner/v1/orders | List orders +*MarkOrderReadyApi* | [**mark_order_ready**](docs/MarkOrderReadyApi.md#mark_order_ready) | **POST** /partner/v1/orders/mark | Mark order as ready +*NotifyMembershipWebviewApi* | [**notify_membership_webview**](docs/NotifyMembershipWebviewApi.md#notify_membership_webview) | **POST** /partner/v1/membership/notify | Notify Membership +*PauseStoreApi* | [**pause_store**](docs/PauseStoreApi.md#pause_store) | **PUT** /partner/v1/merchant/pause | Pause store +*RedeemDineinVoucherApi* | [**redeem_dinein_voucher**](docs/RedeemDineinVoucherApi.md#redeem_dinein_voucher) | **POST** /partner/v1/dinein/voucher/redeem | Redeem Dine In Voucher +*TraceMenuSyncApi* | [**trace_menu_sync**](docs/TraceMenuSyncApi.md#trace_menu_sync) | **GET** /partner/v1/merchant/menu/trace | Trace menu sync +*UpdateCampaignApi* | [**update_campaign**](docs/UpdateCampaignApi.md#update_campaign) | **PUT** /partner/v1/campaigns/{campaign_id} | Update campaign +*UpdateDeliveryStateApi* | [**update_delivery_state**](docs/UpdateDeliveryStateApi.md#update_delivery_state) | **POST** /partner/v1/order/delivery | Update delivery state +*UpdateMenuNotificationApi* | [**update_menu_notification**](docs/UpdateMenuNotificationApi.md#update_menu_notification) | **POST** /partner/v1/merchant/menu/notification | Notify Grab of updated menu +*UpdateMenuRecordApi* | [**batch_update_menu**](docs/UpdateMenuRecordApi.md#batch_update_menu) | **PUT** /partner/v1/batch/menu | Batch Update Menu +*UpdateMenuRecordApi* | [**update_menu**](docs/UpdateMenuRecordApi.md#update_menu) | **PUT** /partner/v1/menu | Update menu record +*UpdateOrderReadyTimeApi* | [**update_order_ready_time**](docs/UpdateOrderReadyTimeApi.md#update_order_ready_time) | **PUT** /partner/v1/order/readytime | Update new order ready time +*UpdateStoreDeliveryHourApi* | [**update_store_delivery_hour**](docs/UpdateStoreDeliveryHourApi.md#update_store_delivery_hour) | **PUT** /partner/v1/merchants/{merchantID}/store/opening-hours | Update Store Delivery Hours +*UpdateStoreDineInHourApi* | [**update_store_dine_in_hour**](docs/UpdateStoreDineInHourApi.md#update_store_dine_in_hour) | **PUT** /partner/v1/merchants/{merchantID}/store/dine-in-hours | Update Store Dine-in Hours +*UpdateStoreSpecialHourApi* | [**update_store_special_hour**](docs/UpdateStoreSpecialHourApi.md#update_store_special_hour) | **PUT** /partner/v2/merchants/{merchantID}/store/special-opening-hour | Update Store Special Hours + + +## Documentation For Models + + - [AcceptOrderRequest](docs/AcceptOrderRequest.md) + - [Address](docs/Address.md) + - [AdvancedPricing](docs/AdvancedPricing.md) + - [BatchUpdateMenuItem](docs/BatchUpdateMenuItem.md) + - [BatchUpdateMenuResponse](docs/BatchUpdateMenuResponse.md) + - [BindMembershipNativeRequest](docs/BindMembershipNativeRequest.md) + - [BindMembershipNativeResponse](docs/BindMembershipNativeResponse.md) + - [Campaign](docs/Campaign.md) + - [CampaignConditions](docs/CampaignConditions.md) + - [CampaignDiscount](docs/CampaignDiscount.md) + - [CampaignQuotas](docs/CampaignQuotas.md) + - [CampaignScope](docs/CampaignScope.md) + - [CancelCode](docs/CancelCode.md) + - [CancelOrderLimitType](docs/CancelOrderLimitType.md) + - [CancelOrderRequest](docs/CancelOrderRequest.md) + - [CancelOrderResponse](docs/CancelOrderResponse.md) + - [CancelReason](docs/CancelReason.md) + - [CheckOrderCancelableResponse](docs/CheckOrderCancelableResponse.md) + - [Coordinates](docs/Coordinates.md) + - [CreateCampaignRequest](docs/CreateCampaignRequest.md) + - [CreateCampaignResponse](docs/CreateCampaignResponse.md) + - [CreateSelfServeJourneyRequest](docs/CreateSelfServeJourneyRequest.md) + - [CreateSelfServeJourneyRequestPartner](docs/CreateSelfServeJourneyRequestPartner.md) + - [CreateSelfServeJourneyResponse](docs/CreateSelfServeJourneyResponse.md) + - [Currency](docs/Currency.md) + - [DineIn](docs/DineIn.md) + - [EditOrderItem](docs/EditOrderItem.md) + - [EditOrderRequest](docs/EditOrderRequest.md) + - [Error](docs/Error.md) + - [GetDineInVoucherResponse](docs/GetDineInVoucherResponse.md) + - [GetMembershipNativeResponse](docs/GetMembershipNativeResponse.md) + - [GetMembershipNativeResponsePointInfo](docs/GetMembershipNativeResponsePointInfo.md) + - [GetMembershipRequest](docs/GetMembershipRequest.md) + - [GetMembershipWebviewResponse](docs/GetMembershipWebviewResponse.md) + - [GetMenuNewResponse](docs/GetMenuNewResponse.md) + - [GetMenuOldResponse](docs/GetMenuOldResponse.md) + - [GetRewardNativeRequest](docs/GetRewardNativeRequest.md) + - [GetRewardNativeResponse](docs/GetRewardNativeResponse.md) + - [GrabOauthRequest](docs/GrabOauthRequest.md) + - [GrabOauthResponse](docs/GrabOauthResponse.md) + - [ListCampaignResponse](docs/ListCampaignResponse.md) + - [ListOrdersResponse](docs/ListOrdersResponse.md) + - [MarkOrderRequest](docs/MarkOrderRequest.md) + - [MenuCategory](docs/MenuCategory.md) + - [MenuEntity](docs/MenuEntity.md) + - [MenuEntityError](docs/MenuEntityError.md) + - [MenuItem](docs/MenuItem.md) + - [MenuModifier](docs/MenuModifier.md) + - [MenuSection](docs/MenuSection.md) + - [MenuSectionCategory](docs/MenuSectionCategory.md) + - [MenuSectionCategoryItem](docs/MenuSectionCategoryItem.md) + - [MenuSyncFail](docs/MenuSyncFail.md) + - [MenuSyncFailCategory](docs/MenuSyncFailCategory.md) + - [MenuSyncFailItem](docs/MenuSyncFailItem.md) + - [MenuSyncFailModifier](docs/MenuSyncFailModifier.md) + - [MenuSyncFailModifierGroup](docs/MenuSyncFailModifierGroup.md) + - [MenuSyncFailServiceHours](docs/MenuSyncFailServiceHours.md) + - [MenuSyncResponse](docs/MenuSyncResponse.md) + - [MenuSyncWebhookRequest](docs/MenuSyncWebhookRequest.md) + - [ModifierGroup](docs/ModifierGroup.md) + - [NewOrderTimeRequest](docs/NewOrderTimeRequest.md) + - [NotifyMembershipWebviewRequest](docs/NotifyMembershipWebviewRequest.md) + - [OpenPeriod](docs/OpenPeriod.md) + - [Order](docs/Order.md) + - [OrderCampaign](docs/OrderCampaign.md) + - [OrderDeliveryRequest](docs/OrderDeliveryRequest.md) + - [OrderFeatureFlags](docs/OrderFeatureFlags.md) + - [OrderFreeItem](docs/OrderFreeItem.md) + - [OrderItem](docs/OrderItem.md) + - [OrderItemModifier](docs/OrderItemModifier.md) + - [OrderPrice](docs/OrderPrice.md) + - [OrderPromo](docs/OrderPromo.md) + - [OrderReadyEstimation](docs/OrderReadyEstimation.md) + - [OrderStateRequest](docs/OrderStateRequest.md) + - [OutOfStockInstruction](docs/OutOfStockInstruction.md) + - [PartnerOauthRequest](docs/PartnerOauthRequest.md) + - [PartnerOauthResponse](docs/PartnerOauthResponse.md) + - [PauseStoreRequest](docs/PauseStoreRequest.md) + - [Purchasability](docs/Purchasability.md) + - [PushIntegrationStatusWebhookRequest](docs/PushIntegrationStatusWebhookRequest.md) + - [Receiver](docs/Receiver.md) + - [RedeemDineInVoucherRequest](docs/RedeemDineInVoucherRequest.md) + - [RedeemDineInVoucherResponse](docs/RedeemDineInVoucherResponse.md) + - [RedeemResult](docs/RedeemResult.md) + - [RegisterMembershipNativeRequest](docs/RegisterMembershipNativeRequest.md) + - [RegisterMembershipNativeResponse](docs/RegisterMembershipNativeResponse.md) + - [RewardItem](docs/RewardItem.md) + - [SellingTime](docs/SellingTime.md) + - [ServiceHour](docs/ServiceHour.md) + - [ServiceHours](docs/ServiceHours.md) + - [SpecialOpeningHour](docs/SpecialOpeningHour.md) + - [SpecialOpeningHourMetadata](docs/SpecialOpeningHourMetadata.md) + - [SpecialOpeningHourOpeningHours](docs/SpecialOpeningHourOpeningHours.md) + - [StoreHour](docs/StoreHour.md) + - [StoreHourResponse](docs/StoreHourResponse.md) + - [StoreStatusResponse](docs/StoreStatusResponse.md) + - [SubmitOrderRequest](docs/SubmitOrderRequest.md) + - [UnbindMembershipNativeRequest](docs/UnbindMembershipNativeRequest.md) + - [UnlinkMembershipWebviewRequest](docs/UnlinkMembershipWebviewRequest.md) + - [UpdateAdvancedPricing](docs/UpdateAdvancedPricing.md) + - [UpdateCampaignRequest](docs/UpdateCampaignRequest.md) + - [UpdateDeliveryHourRequest](docs/UpdateDeliveryHourRequest.md) + - [UpdateDeliveryHourResponse](docs/UpdateDeliveryHourResponse.md) + - [UpdateDineInHourRequest](docs/UpdateDineInHourRequest.md) + - [UpdateDineInHourResponse](docs/UpdateDineInHourResponse.md) + - [UpdateMenuItem](docs/UpdateMenuItem.md) + - [UpdateMenuModifier](docs/UpdateMenuModifier.md) + - [UpdateMenuNotifRequest](docs/UpdateMenuNotifRequest.md) + - [UpdateMenuRequest](docs/UpdateMenuRequest.md) + - [UpdatePurchasability](docs/UpdatePurchasability.md) + - [UpdateSpecialHourRequest](docs/UpdateSpecialHourRequest.md) + - [UpdateSpecialHourResponse](docs/UpdateSpecialHourResponse.md) + - [Voucher](docs/Voucher.md) + - [VoucherDescriptionInfo](docs/VoucherDescriptionInfo.md) + - [WorkingHour](docs/WorkingHour.md) + - [WorkingHourDay](docs/WorkingHourDay.md) + + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Author + + + + diff --git a/docs/AcceptOrderRequest.md b/docs/AcceptOrderRequest.md new file mode 100644 index 0000000..67b47a7 --- /dev/null +++ b/docs/AcceptOrderRequest.md @@ -0,0 +1,31 @@ +# AcceptOrderRequest + +The manual acceptance or rejection of an order on GrabFood. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_id** | **str** | The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**to_state** | **str** | The order's updated state. | + +## Example + +```python +from grabfood.models.accept_order_request import AcceptOrderRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of AcceptOrderRequest from a JSON string +accept_order_request_instance = AcceptOrderRequest.from_json(json) +# print the JSON string representation of the object +print(AcceptOrderRequest.to_json()) + +# convert the object into a dict +accept_order_request_dict = accept_order_request_instance.to_dict() +# create an instance of AcceptOrderRequest from a dict +accept_order_request_from_dict = AcceptOrderRequest.from_dict(accept_order_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/AcceptRejectOrderApi.md b/docs/AcceptRejectOrderApi.md new file mode 100644 index 0000000..8d6027b --- /dev/null +++ b/docs/AcceptRejectOrderApi.md @@ -0,0 +1,77 @@ +# grabfood.AcceptRejectOrderApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**accept_reject_order**](AcceptRejectOrderApi.md#accept_reject_order) | **POST** /partner/v1/order/prepare | Manually accept/reject orders + + +# **accept_reject_order** +> accept_reject_order(authorization, content_type, accept_order_request) + +Manually accept/reject orders + +### Example + + +```python +import grabfood +from grabfood.models.accept_order_request import AcceptOrderRequest +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.AcceptRejectOrderApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + accept_order_request = grabfood.AcceptOrderRequest() # AcceptOrderRequest | + + try: + # Manually accept/reject orders + api_instance.accept_reject_order(authorization, content_type, accept_order_request) + except Exception as e: + print("Exception when calling AcceptRejectOrderApi->accept_reject_order: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **accept_order_request** | [**AcceptOrderRequest**](AcceptOrderRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Successful. No content returned. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Address.md b/docs/Address.md new file mode 100644 index 0000000..02fb530 --- /dev/null +++ b/docs/Address.md @@ -0,0 +1,36 @@ +# Address + +A JSON object containing the receiver’s location information. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**unit_number** | **str** | The delivery address' unit number. | [optional] +**delivery_instruction** | **str** | Instructions for the delivery. | [optional] +**poi_source** | **str** | POI source | [optional] +**poi_id** | **str** | POI ID, empty when poiSource is GRAB. | [optional] +**address** | **str** | The delivery address containing street name, city, postal code, and country. Has value only when poiSource is `GRAB`. | [optional] +**postcode** | **str** | The postcode of the delivery address. Has value only when poiSource is `GRAB`. | [optional] +**coordinates** | [**Coordinates**](Coordinates.md) | | [optional] + +## Example + +```python +from grabfood.models.address import Address + +# TODO update the JSON string below +json = "{}" +# create an instance of Address from a JSON string +address_instance = Address.from_json(json) +# print the JSON string representation of the object +print(Address.to_json()) + +# convert the object into a dict +address_dict = address_instance.to_dict() +# create an instance of Address from a dict +address_from_dict = Address.from_dict(address_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/AdvancedPricing.md b/docs/AdvancedPricing.md new file mode 100644 index 0000000..c8451f2 --- /dev/null +++ b/docs/AdvancedPricing.md @@ -0,0 +1,36 @@ +# AdvancedPricing + +Price configuration (in minor unit) for different service, order type and channel combination. If a service type does not have a specified price, it will utilize the default price of the item. Refer [Service Based Menu](#section/Service-Based-Menu). + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**delivery_on_demand_grab_app** | **int** | Service type: `Delivery`, Order type: `Instant`, Channel: `Grab App` | [optional] +**delivery_scheduled_grab_app** | **int** | Service type: `Delivery`, Order type: `Scheduled`, Channel: `Grab App` | [optional] +**self_pick_up_on_demand_grab_app** | **int** | Service type: `Self Pick Up`, Order type: `Instant`, Channel: `Grab App` | [optional] +**dine_in_on_demand_grab_app** | **int** | Service type: `Dine In`, Order type: `Instant`, Channel: `Grab App` | [optional] +**delivery_on_demand_store_front** | **int** | Service type: `Delivery`, Order type: `Instant`, Channel: `Store Front` | [optional] +**delivery_scheduled_store_front** | **int** | Service type: `Delivery`, Order type: `Scheduled`, Channel: `Store Front` | [optional] +**self_pick_up_on_demand_store_front** | **int** | Service type: `Self Pick Up`, Order type: `Instant`, Channel: `Store Front` | [optional] + +## Example + +```python +from grabfood.models.advanced_pricing import AdvancedPricing + +# TODO update the JSON string below +json = "{}" +# create an instance of AdvancedPricing from a JSON string +advanced_pricing_instance = AdvancedPricing.from_json(json) +# print the JSON string representation of the object +print(AdvancedPricing.to_json()) + +# convert the object into a dict +advanced_pricing_dict = advanced_pricing_instance.to_dict() +# create an instance of AdvancedPricing from a dict +advanced_pricing_from_dict = AdvancedPricing.from_dict(advanced_pricing_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BatchUpdateMenuItem.md b/docs/BatchUpdateMenuItem.md new file mode 100644 index 0000000..915ab3f --- /dev/null +++ b/docs/BatchUpdateMenuItem.md @@ -0,0 +1,32 @@ +# BatchUpdateMenuItem + +Information about the GrabFood client updating their food menu. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**var_field** | **str** | The record type that you want to update. | +**menu_entities** | [**List[MenuEntity]**](MenuEntity.md) | The items in an array of JSON Object. | [optional] + +## Example + +```python +from grabfood.models.batch_update_menu_item import BatchUpdateMenuItem + +# TODO update the JSON string below +json = "{}" +# create an instance of BatchUpdateMenuItem from a JSON string +batch_update_menu_item_instance = BatchUpdateMenuItem.from_json(json) +# print the JSON string representation of the object +print(BatchUpdateMenuItem.to_json()) + +# convert the object into a dict +batch_update_menu_item_dict = batch_update_menu_item_instance.to_dict() +# create an instance of BatchUpdateMenuItem from a dict +batch_update_menu_item_from_dict = BatchUpdateMenuItem.from_dict(batch_update_menu_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BatchUpdateMenuResponse.md b/docs/BatchUpdateMenuResponse.md new file mode 100644 index 0000000..74a9676 --- /dev/null +++ b/docs/BatchUpdateMenuResponse.md @@ -0,0 +1,31 @@ +# BatchUpdateMenuResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | [optional] +**status** | **str** | The status of this request. | [optional] +**errors** | [**List[MenuEntityError]**](MenuEntityError.md) | The error messages when batch update menu record was partial success/fail. `null` when the request was success. | [optional] + +## Example + +```python +from grabfood.models.batch_update_menu_response import BatchUpdateMenuResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of BatchUpdateMenuResponse from a JSON string +batch_update_menu_response_instance = BatchUpdateMenuResponse.from_json(json) +# print the JSON string representation of the object +print(BatchUpdateMenuResponse.to_json()) + +# convert the object into a dict +batch_update_menu_response_dict = batch_update_menu_response_instance.to_dict() +# create an instance of BatchUpdateMenuResponse from a dict +batch_update_menu_response_from_dict = BatchUpdateMenuResponse.from_dict(batch_update_menu_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BindMembershipNativeRequest.md b/docs/BindMembershipNativeRequest.md new file mode 100644 index 0000000..88d98f8 --- /dev/null +++ b/docs/BindMembershipNativeRequest.md @@ -0,0 +1,31 @@ +# BindMembershipNativeRequest + +This request submits membership binding request to partner. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**grab_id** | **str** | The id used to identify an unique grab user. | +**phone_number** | **str** | Grab user phone number used to login. | [optional] + +## Example + +```python +from grabfood.models.bind_membership_native_request import BindMembershipNativeRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of BindMembershipNativeRequest from a JSON string +bind_membership_native_request_instance = BindMembershipNativeRequest.from_json(json) +# print the JSON string representation of the object +print(BindMembershipNativeRequest.to_json()) + +# convert the object into a dict +bind_membership_native_request_dict = bind_membership_native_request_instance.to_dict() +# create an instance of BindMembershipNativeRequest from a dict +bind_membership_native_request_from_dict = BindMembershipNativeRequest.from_dict(bind_membership_native_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BindMembershipNativeResponse.md b/docs/BindMembershipNativeResponse.md new file mode 100644 index 0000000..e5b3bee --- /dev/null +++ b/docs/BindMembershipNativeResponse.md @@ -0,0 +1,30 @@ +# BindMembershipNativeResponse + +This response returns membershipID after membership binding is successful. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**member_id** | **str** | The unique member ID on the partner's database. | + +## Example + +```python +from grabfood.models.bind_membership_native_response import BindMembershipNativeResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of BindMembershipNativeResponse from a JSON string +bind_membership_native_response_instance = BindMembershipNativeResponse.from_json(json) +# print the JSON string representation of the object +print(BindMembershipNativeResponse.to_json()) + +# convert the object into a dict +bind_membership_native_response_dict = bind_membership_native_response_instance.to_dict() +# create an instance of BindMembershipNativeResponse from a dict +bind_membership_native_response_from_dict = BindMembershipNativeResponse.from_dict(bind_membership_native_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Campaign.md b/docs/Campaign.md new file mode 100644 index 0000000..a5d59f2 --- /dev/null +++ b/docs/Campaign.md @@ -0,0 +1,37 @@ +# Campaign + +A JSON object containing the campaign details for a merchant. Only campaigns that are funded by merchants will be sent. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The campaign's ID. | +**created_by** | **str** | The party who created the campaign. Can be created by partners via API, merchants via the merchant app or Grab. | +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**name** | **str** | The campaign's name. | +**quotas** | [**CampaignQuotas**](CampaignQuotas.md) | | [optional] +**conditions** | [**CampaignConditions**](CampaignConditions.md) | | [optional] +**discount** | [**CampaignDiscount**](CampaignDiscount.md) | | [optional] +**custom_tag** | **str** | Specify the tag for custom bundle offer campaign. Only whitelisted partner is supported as of now. | [optional] + +## Example + +```python +from grabfood.models.campaign import Campaign + +# TODO update the JSON string below +json = "{}" +# create an instance of Campaign from a JSON string +campaign_instance = Campaign.from_json(json) +# print the JSON string representation of the object +print(Campaign.to_json()) + +# convert the object into a dict +campaign_dict = campaign_instance.to_dict() +# create an instance of Campaign from a dict +campaign_from_dict = Campaign.from_dict(campaign_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CampaignConditions.md b/docs/CampaignConditions.md new file mode 100644 index 0000000..ce1d518 --- /dev/null +++ b/docs/CampaignConditions.md @@ -0,0 +1,35 @@ +# CampaignConditions + +The conditions to apply to a campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_time** | **datetime** | The campaign's start time in UTC format. For example, 2021-09-23T03:30:00Z means 2021-09-23 11:30:00 (UTC +08:00). | +**end_time** | **datetime** | The campaign's end time in UTC format. | +**eater_type** | **str** | The type of eater eligible for the campaign. * `all` - campaign will be applied to everyone. No limitation on campaign type. * `new` - campaign will be applied to consumers who have not ordered from this store in the last three months. Only applicable to **order-level** campaign. | +**min_basket_amount** | **float** | The minimum basket amount to be eligible for the campaign. Only applicable to **order-level** campaign but not to item-level discount campaign. | [optional] +**bundle_quantity** | **int** | Specify the bundle quantity for bundle offer campaign. | [optional] +**working_hour** | [**WorkingHour**](WorkingHour.md) | | [optional] + +## Example + +```python +from grabfood.models.campaign_conditions import CampaignConditions + +# TODO update the JSON string below +json = "{}" +# create an instance of CampaignConditions from a JSON string +campaign_conditions_instance = CampaignConditions.from_json(json) +# print the JSON string representation of the object +print(CampaignConditions.to_json()) + +# convert the object into a dict +campaign_conditions_dict = campaign_conditions_instance.to_dict() +# create an instance of CampaignConditions from a dict +campaign_conditions_from_dict = CampaignConditions.from_dict(campaign_conditions_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CampaignDiscount.md b/docs/CampaignDiscount.md new file mode 100644 index 0000000..e74c19e --- /dev/null +++ b/docs/CampaignDiscount.md @@ -0,0 +1,33 @@ +# CampaignDiscount + +The discount detail for a particular campaign when conditions are satisfied. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | The type of discount | +**cap** | **float** | The maximum discount dollar amount. It is **not required** and will be ignored when the `discount.type` is: - `net` - `delivery` - `freeItem` - `bundleSameNet` - `bundleSamePercentage` - `bundleSameFixPrice` - `bundleDiffNet` - `bundleDiffPercentage` - `bundleDiffFixPrice` | [optional] +**value** | **float** | Specify the discount amount. Decimal number is not supported For VN, ID and TH. For example, `10.5` is not allowed and it should be `10.0`. * Dollar amount value when `discount.type` is `net`, `delivery`, `bundleSameNet`, `bundleSameFixPrice`, `bundleDiffNet`, `bundleDiffFixPrice`. * Percentage value (0-100) when `discount.type` is `percentage`, `bundleSamePercentage`, `bundleDiffPercentage`. * **Not required** when `discount.type` is `freeItem`. | [optional] +**scope** | [**CampaignScope**](CampaignScope.md) | | + +## Example + +```python +from grabfood.models.campaign_discount import CampaignDiscount + +# TODO update the JSON string below +json = "{}" +# create an instance of CampaignDiscount from a JSON string +campaign_discount_instance = CampaignDiscount.from_json(json) +# print the JSON string representation of the object +print(CampaignDiscount.to_json()) + +# convert the object into a dict +campaign_discount_dict = campaign_discount_instance.to_dict() +# create an instance of CampaignDiscount from a dict +campaign_discount_from_dict = CampaignDiscount.from_dict(campaign_discount_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CampaignQuotas.md b/docs/CampaignQuotas.md new file mode 100644 index 0000000..f2c425b --- /dev/null +++ b/docs/CampaignQuotas.md @@ -0,0 +1,31 @@ +# CampaignQuotas + +The quotas/limits for a particular campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_count** | **int** | The maximum number of redemptions. Default is unlimited if unspecified. | [optional] +**total_count_per_user** | **int** | The maximum number of redemptions per user. Default is unlimited if unspecified. | [optional] + +## Example + +```python +from grabfood.models.campaign_quotas import CampaignQuotas + +# TODO update the JSON string below +json = "{}" +# create an instance of CampaignQuotas from a JSON string +campaign_quotas_instance = CampaignQuotas.from_json(json) +# print the JSON string representation of the object +print(CampaignQuotas.to_json()) + +# convert the object into a dict +campaign_quotas_dict = campaign_quotas_instance.to_dict() +# create an instance of CampaignQuotas from a dict +campaign_quotas_from_dict = CampaignQuotas.from_dict(campaign_quotas_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CampaignScope.md b/docs/CampaignScope.md new file mode 100644 index 0000000..3fd10b7 --- /dev/null +++ b/docs/CampaignScope.md @@ -0,0 +1,31 @@ +# CampaignScope + +The scope level for a particular campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | The scope type for this campaign. * `order` - order level campaign. * `items` - item level campaign or bundle offer. * `category` - category level campaign where all items within applies the same discount. | +**object_ids** | **List[str]** | The list of item IDs in the partner's database applicable for discount when `discount.scope.type` is `items` (or category IDs for `category`). One and only 1 item supported when `discount.type` is: - `freeItem` - `bundleSameNet` - `bundleSamePercentage` - `bundleSameFixPrice` Minimum 2 - Maximum 20 items supported when `discount.type` is: - `bundleDiffNet` - `bundleDiffPercentage` - `bundleDiffFixPrice` | [optional] + +## Example + +```python +from grabfood.models.campaign_scope import CampaignScope + +# TODO update the JSON string below +json = "{}" +# create an instance of CampaignScope from a JSON string +campaign_scope_instance = CampaignScope.from_json(json) +# print the JSON string representation of the object +print(CampaignScope.to_json()) + +# convert the object into a dict +campaign_scope_dict = campaign_scope_instance.to_dict() +# create an instance of CampaignScope from a dict +campaign_scope_from_dict = CampaignScope.from_dict(campaign_scope_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CancelCode.md b/docs/CancelCode.md new file mode 100644 index 0000000..cff7e2d --- /dev/null +++ b/docs/CancelCode.md @@ -0,0 +1,17 @@ +# CancelCode + +The cancel code for a specific cancel reason. + +## Enum + +* `NUMBER_1001` (value: `1001`) + +* `NUMBER_1002` (value: `1002`) + +* `NUMBER_1003` (value: `1003`) + +* `NUMBER_1004` (value: `1004`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CancelOrderApi.md b/docs/CancelOrderApi.md new file mode 100644 index 0000000..b7dea4a --- /dev/null +++ b/docs/CancelOrderApi.md @@ -0,0 +1,85 @@ +# grabfood.CancelOrderApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**cancel_order**](CancelOrderApi.md#cancel_order) | **PUT** /partner/v1/order/cancel | Cancel an order + + +# **cancel_order** +> CancelOrderResponse cancel_order(content_type, authorization, cancel_order_request) + +Cancel an order + +### Example + + +```python +import grabfood +from grabfood.models.cancel_order_request import CancelOrderRequest +from grabfood.models.cancel_order_response import CancelOrderResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.CancelOrderApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + cancel_order_request = grabfood.CancelOrderRequest() # CancelOrderRequest | + + try: + # Cancel an order + api_response = api_instance.cancel_order(content_type, authorization, cancel_order_request) + print("The response of CancelOrderApi->cancel_order:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CancelOrderApi->cancel_order: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **cancel_order_request** | [**CancelOrderRequest**](CancelOrderRequest.md)| | + +### Return type + +[**CancelOrderResponse**](CancelOrderResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The API request is successfully processed. | - | +**400** | invalid_argument | - | +**403** | This request is forbidden. For each 403 HTTP response, a detailed reason will be returned. | Type | Message | | -------| ------------| | Invalid order | Order cannot be cancelled via this endpoint as this order does not belong to you. Please contact Grab Support for further assistance. | | Daily limit reached | Order cannot be cancelled via this endpoint as the daily limit for order cancellations has been reached. Please contact Grab Support for further assistance. | | Weekly limit reached | Order cannot be cancelled via this endpoint as the weekly limit for order cancellations has been reached. Please contact Grab Support for further assistance. | | Monthly limit reached | Order cannot be cancelled via this endpoint as the monthly limit for order cancellations has been reached. Please contact Grab Support for further assistance. | | Mix and match order | Order cannot be cancelled via this endpoint as it is part of a GKMM (Grab Kitchen Mix And Match) order. Please contact Grab Support for further assistance. | | Self-pick up order | Order cannot be cancelled via this endpoint as it is a self-pick up order. Please contact Grab Support for further assistance. | | Scheduled order | Order cannot be cancelled via this endpoint as it is a scheduled order. Please contact Grab Support for further assistance. | | Time limit | Order cannot be cancelled via this endpoint as the cancellation time limit has been reached since a driver has been allocated for too long. Please contact Grab Support for further assistance. | | Manual-accept stores | Order cannot be cancelled via this endpoint as only stores on auto-accept can use this endpoint. Please contact Grab Support for further assistance. | | Outdated driver app | Order cannot be cancelled via this endpoint as the driver's Grab app is outdated. Please contact Grab Support for further assistance. | | Unallocated order | Order cannot be cancelled via this endpoint as the order has not been allocated yet. Please contact Grab Support for further assistance. | | Default error (edge case) | Order cannot be cancelled via this endpoint as a default error has occured. Please contact Grab Support for further assistance. | | - | +**404** | not_found | - | +**409** | conflict | - | +**500** | 5XX error codes are rare and indicate that GrabFood is facing an internal server error. This type of error is applicable to all HTTP response codes in the 500 range, e.g. 500, 504. Retry the operation at a later time with a unique ID. Use an exponential backoff retry mechanism to resend the requests at an increasingly slower interval. It is also a good practice to use a randomized delay (jitter) in your retry schedule. | Type | Message | | -------| ------------| | Get order error | Get order failed. | | Cancel order error | Cancel order failed. | | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/CancelOrderLimitType.md b/docs/CancelOrderLimitType.md new file mode 100644 index 0000000..0d8146a --- /dev/null +++ b/docs/CancelOrderLimitType.md @@ -0,0 +1,19 @@ +# CancelOrderLimitType + +The type of the order cancellation limit. + +## Enum + +* `NOT_APPROACHING_LIMIT` (value: `'not approaching limit'`) + +* `APPROACHING_THE_DAILY_LIMIT` (value: `'approaching the daily limit'`) + +* `APPROACHING_THE_WEEKLY_LIMIT` (value: `'approaching the weekly limit'`) + +* `APPROACHING_THE_MONTHLY_LIMIT` (value: `'approaching the monthly limit'`) + +* `EMPTY` (value: `''`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CancelOrderRequest.md b/docs/CancelOrderRequest.md new file mode 100644 index 0000000..b149d67 --- /dev/null +++ b/docs/CancelOrderRequest.md @@ -0,0 +1,32 @@ +# CancelOrderRequest + +This request cancels an order on GrabFood. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_id** | **str** | The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**cancel_code** | [**CancelCode**](CancelCode.md) | | + +## Example + +```python +from grabfood.models.cancel_order_request import CancelOrderRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of CancelOrderRequest from a JSON string +cancel_order_request_instance = CancelOrderRequest.from_json(json) +# print the JSON string representation of the object +print(CancelOrderRequest.to_json()) + +# convert the object into a dict +cancel_order_request_dict = cancel_order_request_instance.to_dict() +# create an instance of CancelOrderRequest from a dict +cancel_order_request_from_dict = CancelOrderRequest.from_dict(cancel_order_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CancelOrderResponse.md b/docs/CancelOrderResponse.md new file mode 100644 index 0000000..e8eedc9 --- /dev/null +++ b/docs/CancelOrderResponse.md @@ -0,0 +1,31 @@ +# CancelOrderResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**limit_type** | [**CancelOrderLimitType**](CancelOrderLimitType.md) | | [optional] +**limit_times** | **int** | The remaining cancellation quota for the merchant. A value is only returned when the nearest remaining cancellation limit is approaching, else it returns 0. | [optional] + +## Example + +```python +from grabfood.models.cancel_order_response import CancelOrderResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CancelOrderResponse from a JSON string +cancel_order_response_instance = CancelOrderResponse.from_json(json) +# print the JSON string representation of the object +print(CancelOrderResponse.to_json()) + +# convert the object into a dict +cancel_order_response_dict = cancel_order_response_instance.to_dict() +# create an instance of CancelOrderResponse from a dict +cancel_order_response_from_dict = CancelOrderResponse.from_dict(cancel_order_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CancelReason.md b/docs/CancelReason.md new file mode 100644 index 0000000..c11d50c --- /dev/null +++ b/docs/CancelReason.md @@ -0,0 +1,30 @@ +# CancelReason + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | [**CancelCode**](CancelCode.md) | | [optional] +**reason** | **str** | The detailed cancel reason for the specific cancel code. - Items are unavailable <code 1001> - I have too many orders now <code 1002> - My shop is closed <code 1003> - My shop is closing soon <code 1004> | [optional] + +## Example + +```python +from grabfood.models.cancel_reason import CancelReason + +# TODO update the JSON string below +json = "{}" +# create an instance of CancelReason from a JSON string +cancel_reason_instance = CancelReason.from_json(json) +# print the JSON string representation of the object +print(CancelReason.to_json()) + +# convert the object into a dict +cancel_reason_dict = cancel_reason_instance.to_dict() +# create an instance of CancelReason from a dict +cancel_reason_from_dict = CancelReason.from_dict(cancel_reason_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CheckOrderCancelableApi.md b/docs/CheckOrderCancelableApi.md new file mode 100644 index 0000000..d1846ee --- /dev/null +++ b/docs/CheckOrderCancelableApi.md @@ -0,0 +1,79 @@ +# grabfood.CheckOrderCancelableApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**check_order_cancelable**](CheckOrderCancelableApi.md#check_order_cancelable) | **GET** /partner/v1/order/cancelable | Check order cancelable + + +# **check_order_cancelable** +> CheckOrderCancelableResponse check_order_cancelable(authorization, order_id, merchant_id) + +Check order cancelable + +### Example + + +```python +import grabfood +from grabfood.models.check_order_cancelable_response import CheckOrderCancelableResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.CheckOrderCancelableApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + order_id = 'order_id_example' # str | + merchant_id = '1-CYNGRUNGSBCCC' # str | The merchant's ID that is in GrabFood's database. + + try: + # Check order cancelable + api_response = api_instance.check_order_cancelable(authorization, order_id, merchant_id) + print("The response of CheckOrderCancelableApi->check_order_cancelable:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CheckOrderCancelableApi->check_order_cancelable: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **order_id** | **str**| | + **merchant_id** | **str**| The merchant's ID that is in GrabFood's database. | + +### Return type + +[**CheckOrderCancelableResponse**](CheckOrderCancelableResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The API request is successfully processed. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/CheckOrderCancelableResponse.md b/docs/CheckOrderCancelableResponse.md new file mode 100644 index 0000000..02ce451 --- /dev/null +++ b/docs/CheckOrderCancelableResponse.md @@ -0,0 +1,34 @@ +# CheckOrderCancelableResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cancel_able** | **bool** | The boolean value to indicate whether an order can be cancelled. | [optional] +**non_cancellation_reason** | **str** | The reason for the order to be non-cancelable. | [optional] +**limit_type** | [**CancelOrderLimitType**](CancelOrderLimitType.md) | | [optional] +**limit_times** | **int** | The remaining cancellation quota for the merchant. A value is only returned when the nearest remaining cancellation limit is approaching, else it returns 0. | [optional] +**cancel_reasons** | [**List[CancelReason]**](CancelReason.md) | An array of cancel order reasons JSON objects. | [optional] + +## Example + +```python +from grabfood.models.check_order_cancelable_response import CheckOrderCancelableResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CheckOrderCancelableResponse from a JSON string +check_order_cancelable_response_instance = CheckOrderCancelableResponse.from_json(json) +# print the JSON string representation of the object +print(CheckOrderCancelableResponse.to_json()) + +# convert the object into a dict +check_order_cancelable_response_dict = check_order_cancelable_response_instance.to_dict() +# create an instance of CheckOrderCancelableResponse from a dict +check_order_cancelable_response_from_dict = CheckOrderCancelableResponse.from_dict(check_order_cancelable_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Coordinates.md b/docs/Coordinates.md new file mode 100644 index 0000000..3c8f79a --- /dev/null +++ b/docs/Coordinates.md @@ -0,0 +1,31 @@ +# Coordinates + +A JSON object containing the coordinates of the delivery address. Only has value when poiSource is `GRAB`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**latitude** | **float** | The latitude coordinates of the delivery address. | [optional] +**longitude** | **float** | The longitude coordinates of the delivery address. | [optional] + +## Example + +```python +from grabfood.models.coordinates import Coordinates + +# TODO update the JSON string below +json = "{}" +# create an instance of Coordinates from a JSON string +coordinates_instance = Coordinates.from_json(json) +# print the JSON string representation of the object +print(Coordinates.to_json()) + +# convert the object into a dict +coordinates_dict = coordinates_instance.to_dict() +# create an instance of Coordinates from a dict +coordinates_from_dict = Coordinates.from_dict(coordinates_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateCampaignApi.md b/docs/CreateCampaignApi.md new file mode 100644 index 0000000..3e90d87 --- /dev/null +++ b/docs/CreateCampaignApi.md @@ -0,0 +1,81 @@ +# grabfood.CreateCampaignApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_campaign**](CreateCampaignApi.md#create_campaign) | **POST** /partner/v1/campaigns | Create campaign + + +# **create_campaign** +> CreateCampaignResponse create_campaign(content_type, authorization, create_campaign_request) + +Create campaign + +### Example + + +```python +import grabfood +from grabfood.models.create_campaign_request import CreateCampaignRequest +from grabfood.models.create_campaign_response import CreateCampaignResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.CreateCampaignApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + create_campaign_request = grabfood.CreateCampaignRequest() # CreateCampaignRequest | + + try: + # Create campaign + api_response = api_instance.create_campaign(content_type, authorization, create_campaign_request) + print("The response of CreateCampaignApi->create_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CreateCampaignApi->create_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **create_campaign_request** | [**CreateCampaignRequest**](CreateCampaignRequest.md)| | + +### Return type + +[**CreateCampaignResponse**](CreateCampaignResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The API request is successfully processed. | - | +**400** | invalid_argument | Code | Reason | Message | | ---- | ---------------- | ----------------------------------- | | 400 | invalid_argument | items not found | | 400 | invalid_argument | startTime has to be after now | | 400 | invalid_argument | CAMPAIGN_START_TIME_TOO_CLOSE_TO_NOW:failed to create MFC: | | 400 | invalid_argument | CAMPAIGN_DURATION_TOO_LONG:failed to create MFC: | | 400 | invalid_argument | EFFECTIVE_DATE_OVERLAP:failed to create MFC: Item(s) are on multiple promotions in the same promotion period: SGITE2021052909250501859400 (4-CY4VMFMANYBYJ6-CZNZFFL1G8KKLX-94794295)\" | | 400 | invalid_argument | EATER_TYPE_CONDITION_IS_NOT_SUPPORTED:failed to create MFC: This level campaign can't be applied for such eater type | | 400 | invalid_argument | INVALID_QUOTAS:failed to create MFC: | | 400 | invalid_argument | INVALID_DISCOUNT_VALUE:failed to create MFC: | | 400 | invalid_argument | INVALID_PARAMS:failed to create MFC: Order level campaign should have min basket condition | | 400 | invalid_argument | INVALID_BUNDLE_OFFER:failed to create MFC: bundle price invalid | | 400 | invalid_argument | INVALID_BUNDLE_OFFER:failed to create MFC: itemIDs should be between 2 and 20 | | 400 | invalid_argument | NOT_SUPPORT_BUNDLE_SAME_MULTIPLE_ITEMS:failed to create MFC: bundle multiple items is not supported for same item bundle | | 400 | invalid_argument | EXCEED_ACTIVE_CAMPAIGN_MAX_LIMIT:failed to create MFC: number of same campaign level's promotions exceeds maximum limit(100) | | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/CreateCampaignRequest.md b/docs/CreateCampaignRequest.md new file mode 100644 index 0000000..4e87b23 --- /dev/null +++ b/docs/CreateCampaignRequest.md @@ -0,0 +1,35 @@ +# CreateCampaignRequest + +This request creates a campaign for your GrabFood store. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**name** | **str** | The campaign's name. | +**quotas** | [**CampaignQuotas**](CampaignQuotas.md) | | [optional] +**conditions** | [**CampaignConditions**](CampaignConditions.md) | | +**discount** | [**CampaignDiscount**](CampaignDiscount.md) | | +**custom_tag** | **str** | Specify the tag for custom bundle offer campaign. Only whitelisted partner is supported as of now. | [optional] + +## Example + +```python +from grabfood.models.create_campaign_request import CreateCampaignRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateCampaignRequest from a JSON string +create_campaign_request_instance = CreateCampaignRequest.from_json(json) +# print the JSON string representation of the object +print(CreateCampaignRequest.to_json()) + +# convert the object into a dict +create_campaign_request_dict = create_campaign_request_instance.to_dict() +# create an instance of CreateCampaignRequest from a dict +create_campaign_request_from_dict = CreateCampaignRequest.from_dict(create_campaign_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateCampaignResponse.md b/docs/CreateCampaignResponse.md new file mode 100644 index 0000000..da37f40 --- /dev/null +++ b/docs/CreateCampaignResponse.md @@ -0,0 +1,30 @@ +# CreateCampaignResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The campaign's ID. | [optional] + +## Example + +```python +from grabfood.models.create_campaign_response import CreateCampaignResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateCampaignResponse from a JSON string +create_campaign_response_instance = CreateCampaignResponse.from_json(json) +# print the JSON string representation of the object +print(CreateCampaignResponse.to_json()) + +# convert the object into a dict +create_campaign_response_dict = create_campaign_response_instance.to_dict() +# create an instance of CreateCampaignResponse from a dict +create_campaign_response_from_dict = CreateCampaignResponse.from_dict(create_campaign_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateSelfServeJourneyApi.md b/docs/CreateSelfServeJourneyApi.md new file mode 100644 index 0000000..5aee024 --- /dev/null +++ b/docs/CreateSelfServeJourneyApi.md @@ -0,0 +1,80 @@ +# grabfood.CreateSelfServeJourneyApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_self_serve_journey**](CreateSelfServeJourneyApi.md#create_self_serve_journey) | **POST** /partner/v1/self-serve/activation | Create self serve journey + + +# **create_self_serve_journey** +> CreateSelfServeJourneyResponse create_self_serve_journey(content_type, authorization, create_self_serve_journey_request) + +Create self serve journey + +### Example + + +```python +import grabfood +from grabfood.models.create_self_serve_journey_request import CreateSelfServeJourneyRequest +from grabfood.models.create_self_serve_journey_response import CreateSelfServeJourneyResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.CreateSelfServeJourneyApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + create_self_serve_journey_request = grabfood.CreateSelfServeJourneyRequest() # CreateSelfServeJourneyRequest | + + try: + # Create self serve journey + api_response = api_instance.create_self_serve_journey(content_type, authorization, create_self_serve_journey_request) + print("The response of CreateSelfServeJourneyApi->create_self_serve_journey:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CreateSelfServeJourneyApi->create_self_serve_journey: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **create_self_serve_journey_request** | [**CreateSelfServeJourneyRequest**](CreateSelfServeJourneyRequest.md)| | + +### Return type + +[**CreateSelfServeJourneyResponse**](CreateSelfServeJourneyResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/CreateSelfServeJourneyRequest.md b/docs/CreateSelfServeJourneyRequest.md new file mode 100644 index 0000000..90492b8 --- /dev/null +++ b/docs/CreateSelfServeJourneyRequest.md @@ -0,0 +1,30 @@ +# CreateSelfServeJourneyRequest + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**partner** | [**CreateSelfServeJourneyRequestPartner**](CreateSelfServeJourneyRequestPartner.md) | | + +## Example + +```python +from grabfood.models.create_self_serve_journey_request import CreateSelfServeJourneyRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateSelfServeJourneyRequest from a JSON string +create_self_serve_journey_request_instance = CreateSelfServeJourneyRequest.from_json(json) +# print the JSON string representation of the object +print(CreateSelfServeJourneyRequest.to_json()) + +# convert the object into a dict +create_self_serve_journey_request_dict = create_self_serve_journey_request_instance.to_dict() +# create an instance of CreateSelfServeJourneyRequest from a dict +create_self_serve_journey_request_from_dict = CreateSelfServeJourneyRequest.from_dict(create_self_serve_journey_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateSelfServeJourneyRequestPartner.md b/docs/CreateSelfServeJourneyRequestPartner.md new file mode 100644 index 0000000..6d966c2 --- /dev/null +++ b/docs/CreateSelfServeJourneyRequestPartner.md @@ -0,0 +1,30 @@ +# CreateSelfServeJourneyRequestPartner + +A JSON object containing store information + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is on the partner's database. | + +## Example + +```python +from grabfood.models.create_self_serve_journey_request_partner import CreateSelfServeJourneyRequestPartner + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateSelfServeJourneyRequestPartner from a JSON string +create_self_serve_journey_request_partner_instance = CreateSelfServeJourneyRequestPartner.from_json(json) +# print the JSON string representation of the object +print(CreateSelfServeJourneyRequestPartner.to_json()) + +# convert the object into a dict +create_self_serve_journey_request_partner_dict = create_self_serve_journey_request_partner_instance.to_dict() +# create an instance of CreateSelfServeJourneyRequestPartner from a dict +create_self_serve_journey_request_partner_from_dict = CreateSelfServeJourneyRequestPartner.from_dict(create_self_serve_journey_request_partner_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateSelfServeJourneyResponse.md b/docs/CreateSelfServeJourneyResponse.md new file mode 100644 index 0000000..ff25a2c --- /dev/null +++ b/docs/CreateSelfServeJourneyResponse.md @@ -0,0 +1,30 @@ +# CreateSelfServeJourneyResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**activation_url** | **str** | A JSON object containing store information | + +## Example + +```python +from grabfood.models.create_self_serve_journey_response import CreateSelfServeJourneyResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateSelfServeJourneyResponse from a JSON string +create_self_serve_journey_response_instance = CreateSelfServeJourneyResponse.from_json(json) +# print the JSON string representation of the object +print(CreateSelfServeJourneyResponse.to_json()) + +# convert the object into a dict +create_self_serve_journey_response_dict = create_self_serve_journey_response_instance.to_dict() +# create an instance of CreateSelfServeJourneyResponse from a dict +create_self_serve_journey_response_from_dict = CreateSelfServeJourneyResponse.from_dict(create_self_serve_journey_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Currency.md b/docs/Currency.md new file mode 100644 index 0000000..1baa933 --- /dev/null +++ b/docs/Currency.md @@ -0,0 +1,32 @@ +# Currency + +A JSON object containing code, symbol, and exponent for a given currency. Refer to [Country and Currency](#section/Getting-started/Country-and-currency). + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | The three-letter ISO currency code. This is the currency that is associated with the payment amount. | +**symbol** | **str** | The currency symbol. | +**exponent** | **int** | The log base 10 of the number of times we have to multiply the major unit to get the minor unit. Should be 0 for VN and 2 for other countries (SG/MY/ID/TH/PH/KH). | + +## Example + +```python +from grabfood.models.currency import Currency + +# TODO update the JSON string below +json = "{}" +# create an instance of Currency from a JSON string +currency_instance = Currency.from_json(json) +# print the JSON string representation of the object +print(Currency.to_json()) + +# convert the object into a dict +currency_dict = currency_instance.to_dict() +# create an instance of Currency from a dict +currency_from_dict = Currency.from_dict(currency_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/DeleteCampaignApi.md b/docs/DeleteCampaignApi.md new file mode 100644 index 0000000..dfd1dc2 --- /dev/null +++ b/docs/DeleteCampaignApi.md @@ -0,0 +1,74 @@ +# grabfood.DeleteCampaignApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**delete_campaign**](DeleteCampaignApi.md#delete_campaign) | **DELETE** /partner/v1/campaigns/{campaign_id} | Delete campaigns + + +# **delete_campaign** +> delete_campaign(authorization, campaign_id) + +Delete campaigns + +### Example + + +```python +import grabfood +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.DeleteCampaignApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + campaign_id = 'campaign_id_example' # str | + + try: + # Delete campaigns + api_instance.delete_campaign(authorization, campaign_id) + except Exception as e: + print("Exception when calling DeleteCampaignApi->delete_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **campaign_id** | **str**| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The API request is successfully processed. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/DineIn.md b/docs/DineIn.md new file mode 100644 index 0000000..0986819 --- /dev/null +++ b/docs/DineIn.md @@ -0,0 +1,31 @@ +# DineIn + +A JSON object containing order at table information. Only applicable for dine-in order. `null` if not applicable. Not present in [ListOrder](#tag/list-order/operation/list-orders) response. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**table_id** | **str** | Table number. | [optional] +**eater_count** | **int** | The number of eaters. | [optional] + +## Example + +```python +from grabfood.models.dine_in import DineIn + +# TODO update the JSON string below +json = "{}" +# create an instance of DineIn from a JSON string +dine_in_instance = DineIn.from_json(json) +# print the JSON string representation of the object +print(DineIn.to_json()) + +# convert the object into a dict +dine_in_dict = dine_in_instance.to_dict() +# create an instance of DineIn from a dict +dine_in_from_dict = DineIn.from_dict(dine_in_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EditOrderApi.md b/docs/EditOrderApi.md new file mode 100644 index 0000000..7a539c0 --- /dev/null +++ b/docs/EditOrderApi.md @@ -0,0 +1,80 @@ +# grabfood.EditOrderApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**edit_order**](EditOrderApi.md#edit_order) | **PUT** /partner/v1/orders/{orderID} | Edit Order + + +# **edit_order** +> edit_order(content_type, authorization, order_id, edit_order_request) + +Edit Order + +### Example + + +```python +import grabfood +from grabfood.models.edit_order_request import EditOrderRequest +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.EditOrderApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + order_id = 'order_id_example' # str | + edit_order_request = grabfood.EditOrderRequest() # EditOrderRequest | + + try: + # Edit Order + api_instance.edit_order(content_type, authorization, order_id, edit_order_request) + except Exception as e: + print("Exception when calling EditOrderApi->edit_order: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **order_id** | **str**| | + **edit_order_request** | [**EditOrderRequest**](EditOrderRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Successful. No content returned. | - | +**4XX** | invalid_argument Fail example with code and reason. | Code | Reason | Message | | ------| ------| ------ | | 400 | invalid_argument | nothing changed | | 400 | invalid_argument | can't remove all items | | 404 | not_found | order detail abnormal | | 403 | forbidden | not editable | | 400 | invalid_argument | recalculate failed | | 400 | invalid_argument| submit edit failed | | 404 | not_found | get merchant failed | | 400 | invalid_argument | exceed basket limit | | 400 | invalid_argument | exceed price increase limit | | 400 | invalid_argument | negative weight | | 400 | invalid_argument | parameters must include all items | | 400 | invalid_argument | fraud check error | | 400 | invalid_argument | externalItemID not supported for this status | | 400 | invalid_argument | externalItemID inactive or out of selling time | | 400 | invalid_argument | added item invalid | | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/EditOrderItem.md b/docs/EditOrderItem.md new file mode 100644 index 0000000..831e8c6 --- /dev/null +++ b/docs/EditOrderItem.md @@ -0,0 +1,32 @@ +# EditOrderItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**item_id** | **str** | The item's ID in Grab system that can be obtained from the [Submit Order Webhook](#tag/submit-order-webhook/operation/submit-order-webhook) request payload parameters under `items[].grabItemID`, or `items[].outOfStockInstruction.replacementGrabItemID` for item replacement. External item ID from Partner system is only supported when `ADDED` status and `isExternalItemID: true`. | +**status** | **str** | The item's edited status. Leave empty string if there is no change to the item. | +**quantity** | **int** | The item's quantity. If the item is not being updated or deleted, use the original quantity. | [optional] +**is_external_item_id** | **bool** | Only applicable for `ADDED`status. Indicate if the `itemID` is an external item ID. Grab checks for the items that are mapped to the provided item ID, considering their availability. If multiple Grab items are found to be mapped to the provided external item ID, the last updated item will be chosen. If no suitable record is found, an 400 error will be returned to the partner, indicating that the submitted external item ID cannot be edited. | [optional] + +## Example + +```python +from grabfood.models.edit_order_item import EditOrderItem + +# TODO update the JSON string below +json = "{}" +# create an instance of EditOrderItem from a JSON string +edit_order_item_instance = EditOrderItem.from_json(json) +# print the JSON string representation of the object +print(EditOrderItem.to_json()) + +# convert the object into a dict +edit_order_item_dict = edit_order_item_instance.to_dict() +# create an instance of EditOrderItem from a dict +edit_order_item_from_dict = EditOrderItem.from_dict(edit_order_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EditOrderRequest.md b/docs/EditOrderRequest.md new file mode 100644 index 0000000..0d41029 --- /dev/null +++ b/docs/EditOrderRequest.md @@ -0,0 +1,32 @@ +# EditOrderRequest + +Information about editing an existing order on GrabFood. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_id** | **str** | The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**items** | [**List[EditOrderItem]**](EditOrderItem.md) | Specify the array of all items in the order, including deleted, added, updated and unchanged items. | +**only_recalculate** | **bool** | This parameter specifies whether to recalculate the edited order without submitting it. It is intended for testing purposes only. This parameter is set to false by default, which means the edited order will be recalculated and re-submitted to partners. | [optional] + +## Example + +```python +from grabfood.models.edit_order_request import EditOrderRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of EditOrderRequest from a JSON string +edit_order_request_instance = EditOrderRequest.from_json(json) +# print the JSON string representation of the object +print(EditOrderRequest.to_json()) + +# convert the object into a dict +edit_order_request_dict = edit_order_request_instance.to_dict() +# create an instance of EditOrderRequest from a dict +edit_order_request_from_dict = EditOrderRequest.from_dict(edit_order_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Error.md b/docs/Error.md new file mode 100644 index 0000000..fc17c99 --- /dev/null +++ b/docs/Error.md @@ -0,0 +1,31 @@ +# Error + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**target** | **str** | Target of error | [optional] +**reason** | **str** | The type of error. | [optional] +**message** | **str** | The details of the error. | [optional] + +## Example + +```python +from grabfood.models.error import Error + +# TODO update the JSON string below +json = "{}" +# create an instance of Error from a JSON string +error_instance = Error.from_json(json) +# print the JSON string representation of the object +print(Error.to_json()) + +# convert the object into a dict +error_dict = error_instance.to_dict() +# create an instance of Error from a dict +error_from_dict = Error.from_dict(error_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetDineInVoucherResponse.md b/docs/GetDineInVoucherResponse.md new file mode 100644 index 0000000..2a434db --- /dev/null +++ b/docs/GetDineInVoucherResponse.md @@ -0,0 +1,35 @@ +# GetDineInVoucherResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**certificate_id** | **str** | This certificateID is decoded from scanning the QR code, and 1:1 mapping with `voucherCode`. | [optional] +**voucher_code** | **str** | A short code for the dine-in voucher purchased by the user. | [optional] +**voucher** | [**Voucher**](Voucher.md) | | [optional] +**voucher_status** | **str** | The status of the dine-in voucher purchased. Only active voucher is eligible for redemption. | [optional] +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | [optional] +**campaign_id** | **str** | The dine-in voucher campaign's ID in GrabFood's database. | [optional] + +## Example + +```python +from grabfood.models.get_dine_in_voucher_response import GetDineInVoucherResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of GetDineInVoucherResponse from a JSON string +get_dine_in_voucher_response_instance = GetDineInVoucherResponse.from_json(json) +# print the JSON string representation of the object +print(GetDineInVoucherResponse.to_json()) + +# convert the object into a dict +get_dine_in_voucher_response_dict = get_dine_in_voucher_response_instance.to_dict() +# create an instance of GetDineInVoucherResponse from a dict +get_dine_in_voucher_response_from_dict = GetDineInVoucherResponse.from_dict(get_dine_in_voucher_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetDineinVoucherApi.md b/docs/GetDineinVoucherApi.md new file mode 100644 index 0000000..9da08a8 --- /dev/null +++ b/docs/GetDineinVoucherApi.md @@ -0,0 +1,83 @@ +# grabfood.GetDineinVoucherApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_dinein_voucher**](GetDineinVoucherApi.md#get_dinein_voucher) | **GET** /partner/v1/dinein/voucher | Get Dine In Voucher + + +# **get_dinein_voucher** +> GetDineInVoucherResponse get_dinein_voucher(authorization, merchant_id, voucher_code=voucher_code, certificate_id=certificate_id) + +Get Dine In Voucher + +### Example + + +```python +import grabfood +from grabfood.models.get_dine_in_voucher_response import GetDineInVoucherResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.GetDineinVoucherApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + merchant_id = 'merchant_id_example' # str | + voucher_code = 'voucher_code_example' # str | A short code for the dine-in voucher purchased by the user. Required if `certificateID` is not specified. (optional) + certificate_id = 'certificate_id_example' # str | This certificateID is decoded from scanning the QR code, and 1:1 mapping with voucherCode. Required if `voucherCode` is not specified. (optional) + + try: + # Get Dine In Voucher + api_response = api_instance.get_dinein_voucher(authorization, merchant_id, voucher_code=voucher_code, certificate_id=certificate_id) + print("The response of GetDineinVoucherApi->get_dinein_voucher:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GetDineinVoucherApi->get_dinein_voucher: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **merchant_id** | **str**| | + **voucher_code** | **str**| A short code for the dine-in voucher purchased by the user. Required if `certificateID` is not specified. | [optional] + **certificate_id** | **str**| This certificateID is decoded from scanning the QR code, and 1:1 mapping with voucherCode. Required if `voucherCode` is not specified. | [optional] + +### Return type + +[**GetDineInVoucherResponse**](GetDineInVoucherResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The API request is successfully processed. | - | +**400** | invalid_argument | Code | Reason | Message | Description | | ---- | ---------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------- | | 400 | invalid_argument | invalid certificateID | The certificateID is not valid. | | 400 | invalid_argument | voucherCode or certificateID not specified | The voucherCode and certificateID are both empty in params, one of the both must be provided. | | - | +**404** | not_found | Code | Reason | Message | Description | | -----| ----------- | ---------------------------- | ----------------------------------------------------------------------------------------------- | | 404 | not_found | voucher not found | The voucher is not found for the specified voucherCode or certificateID. | | 404 | not_found | failed to get store info | The store is not found for the specified merchantID. | | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/GetMembershipNativeResponse.md b/docs/GetMembershipNativeResponse.md new file mode 100644 index 0000000..939e616 --- /dev/null +++ b/docs/GetMembershipNativeResponse.md @@ -0,0 +1,32 @@ +# GetMembershipNativeResponse + +This response returns membership detail. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**membership_status** | **str** | Status of the memberID. | [optional] +**point_info** | [**GetMembershipNativeResponsePointInfo**](GetMembershipNativeResponsePointInfo.md) | | [optional] +**points_expire_date** | **str** | Earliest points expiry date. In `yyyy-mm-dd` format | [optional] + +## Example + +```python +from grabfood.models.get_membership_native_response import GetMembershipNativeResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of GetMembershipNativeResponse from a JSON string +get_membership_native_response_instance = GetMembershipNativeResponse.from_json(json) +# print the JSON string representation of the object +print(GetMembershipNativeResponse.to_json()) + +# convert the object into a dict +get_membership_native_response_dict = get_membership_native_response_instance.to_dict() +# create an instance of GetMembershipNativeResponse from a dict +get_membership_native_response_from_dict = GetMembershipNativeResponse.from_dict(get_membership_native_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetMembershipNativeResponsePointInfo.md b/docs/GetMembershipNativeResponsePointInfo.md new file mode 100644 index 0000000..9c64a2f --- /dev/null +++ b/docs/GetMembershipNativeResponsePointInfo.md @@ -0,0 +1,32 @@ +# GetMembershipNativeResponsePointInfo + +Obtain contains user's point details. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**current_points** | **int** | Point that user currently obtained. | [optional] +**max_points** | **int** | Maximum point that user can obtain. | [optional] +**expire_points** | **int** | Points that would get expired in future. | [optional] + +## Example + +```python +from grabfood.models.get_membership_native_response_point_info import GetMembershipNativeResponsePointInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of GetMembershipNativeResponsePointInfo from a JSON string +get_membership_native_response_point_info_instance = GetMembershipNativeResponsePointInfo.from_json(json) +# print the JSON string representation of the object +print(GetMembershipNativeResponsePointInfo.to_json()) + +# convert the object into a dict +get_membership_native_response_point_info_dict = get_membership_native_response_point_info_instance.to_dict() +# create an instance of GetMembershipNativeResponsePointInfo from a dict +get_membership_native_response_point_info_from_dict = GetMembershipNativeResponsePointInfo.from_dict(get_membership_native_response_point_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetMembershipRequest.md b/docs/GetMembershipRequest.md new file mode 100644 index 0000000..c872591 --- /dev/null +++ b/docs/GetMembershipRequest.md @@ -0,0 +1,30 @@ +# GetMembershipRequest + +This request submits membership unbind request to partner. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**member_id** | **str** | The unique member ID on the partner's database. | + +## Example + +```python +from grabfood.models.get_membership_request import GetMembershipRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of GetMembershipRequest from a JSON string +get_membership_request_instance = GetMembershipRequest.from_json(json) +# print the JSON string representation of the object +print(GetMembershipRequest.to_json()) + +# convert the object into a dict +get_membership_request_dict = get_membership_request_instance.to_dict() +# create an instance of GetMembershipRequest from a dict +get_membership_request_from_dict = GetMembershipRequest.from_dict(get_membership_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetMembershipWebviewResponse.md b/docs/GetMembershipWebviewResponse.md new file mode 100644 index 0000000..5c0fc39 --- /dev/null +++ b/docs/GetMembershipWebviewResponse.md @@ -0,0 +1,30 @@ +# GetMembershipWebviewResponse + +This response returns membership detail. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**membership_status** | **str** | Status of the memberID. | [optional] + +## Example + +```python +from grabfood.models.get_membership_webview_response import GetMembershipWebviewResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of GetMembershipWebviewResponse from a JSON string +get_membership_webview_response_instance = GetMembershipWebviewResponse.from_json(json) +# print the JSON string representation of the object +print(GetMembershipWebviewResponse.to_json()) + +# convert the object into a dict +get_membership_webview_response_dict = get_membership_webview_response_instance.to_dict() +# create an instance of GetMembershipWebviewResponse from a dict +get_membership_webview_response_from_dict = GetMembershipWebviewResponse.from_dict(get_membership_webview_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetMenuNewResponse.md b/docs/GetMenuNewResponse.md new file mode 100644 index 0000000..c412a86 --- /dev/null +++ b/docs/GetMenuNewResponse.md @@ -0,0 +1,34 @@ +# GetMenuNewResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | [optional] +**partner_merchant_id** | **str** | The merchant's ID that is on the partner's database. | [optional] +**currency** | [**Currency**](Currency.md) | | +**selling_times** | [**List[SellingTime]**](SellingTime.md) | An array of sellingTimes JSON objects. Max 20 allowed. Refer to [Selling Times](#selling-times) for more information. | +**categories** | [**List[MenuCategory]**](MenuCategory.md) | An array of category JSON objects. Max 100 allowed. Refer to [Categories](#categories) for more information. | + +## Example + +```python +from grabfood.models.get_menu_new_response import GetMenuNewResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of GetMenuNewResponse from a JSON string +get_menu_new_response_instance = GetMenuNewResponse.from_json(json) +# print the JSON string representation of the object +print(GetMenuNewResponse.to_json()) + +# convert the object into a dict +get_menu_new_response_dict = get_menu_new_response_instance.to_dict() +# create an instance of GetMenuNewResponse from a dict +get_menu_new_response_from_dict = GetMenuNewResponse.from_dict(get_menu_new_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetMenuOldResponse.md b/docs/GetMenuOldResponse.md new file mode 100644 index 0000000..8d8a2ae --- /dev/null +++ b/docs/GetMenuOldResponse.md @@ -0,0 +1,33 @@ +# GetMenuOldResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | [optional] +**partner_merchant_id** | **str** | The merchant's ID that is on the partner's database. | [optional] +**currency** | [**Currency**](Currency.md) | | +**sections** | [**List[MenuSection]**](MenuSection.md) | An array of section JSON objects. Max 7 allowed. Refer to [Sections](#sections) for more information. | + +## Example + +```python +from grabfood.models.get_menu_old_response import GetMenuOldResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of GetMenuOldResponse from a JSON string +get_menu_old_response_instance = GetMenuOldResponse.from_json(json) +# print the JSON string representation of the object +print(GetMenuOldResponse.to_json()) + +# convert the object into a dict +get_menu_old_response_dict = get_menu_old_response_instance.to_dict() +# create an instance of GetMenuOldResponse from a dict +get_menu_old_response_from_dict = GetMenuOldResponse.from_dict(get_menu_old_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetOauthGrabApi.md b/docs/GetOauthGrabApi.md new file mode 100644 index 0000000..d77c5ef --- /dev/null +++ b/docs/GetOauthGrabApi.md @@ -0,0 +1,78 @@ +# grabfood.GetOauthGrabApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_oauth_grab**](GetOauthGrabApi.md#get_oauth_grab) | **POST** /grabid/v1/oauth2/token | Get Oauth access token + + +# **get_oauth_grab** +> GrabOauthResponse get_oauth_grab(content_type, grab_oauth_request) + +Get Oauth access token + +### Example + + +```python +import grabfood +from grabfood.models.grab_oauth_request import GrabOauthRequest +from grabfood.models.grab_oauth_response import GrabOauthResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.GetOauthGrabApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + grab_oauth_request = grabfood.GrabOauthRequest() # GrabOauthRequest | + + try: + # Get Oauth access token + api_response = api_instance.get_oauth_grab(content_type, grab_oauth_request) + print("The response of GetOauthGrabApi->get_oauth_grab:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GetOauthGrabApi->get_oauth_grab: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **grab_oauth_request** | [**GrabOauthRequest**](GrabOauthRequest.md)| | + +### Return type + +[**GrabOauthResponse**](GrabOauthResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The API request is successfully processed. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/GetRewardNativeRequest.md b/docs/GetRewardNativeRequest.md new file mode 100644 index 0000000..5baa13f --- /dev/null +++ b/docs/GetRewardNativeRequest.md @@ -0,0 +1,33 @@ +# GetRewardNativeRequest + +This request submits membership detail and order value to get reward calculation. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**member_id** | **str** | The unique member ID on the partner's database. | [optional] +**merchant_id** | **str** | Grab merchant's ID. | [optional] +**items** | [**List[RewardItem]**](RewardItem.md) | | [optional] +**order_value** | **int** | The post-discount order value. | [optional] + +## Example + +```python +from grabfood.models.get_reward_native_request import GetRewardNativeRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of GetRewardNativeRequest from a JSON string +get_reward_native_request_instance = GetRewardNativeRequest.from_json(json) +# print the JSON string representation of the object +print(GetRewardNativeRequest.to_json()) + +# convert the object into a dict +get_reward_native_request_dict = get_reward_native_request_instance.to_dict() +# create an instance of GetRewardNativeRequest from a dict +get_reward_native_request_from_dict = GetRewardNativeRequest.from_dict(get_reward_native_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetRewardNativeResponse.md b/docs/GetRewardNativeResponse.md new file mode 100644 index 0000000..e57e321 --- /dev/null +++ b/docs/GetRewardNativeResponse.md @@ -0,0 +1,30 @@ +# GetRewardNativeResponse + +This response returns reward points earn for this order. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The reward points earned in this purchase. | + +## Example + +```python +from grabfood.models.get_reward_native_response import GetRewardNativeResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of GetRewardNativeResponse from a JSON string +get_reward_native_response_instance = GetRewardNativeResponse.from_json(json) +# print the JSON string representation of the object +print(GetRewardNativeResponse.to_json()) + +# convert the object into a dict +get_reward_native_response_dict = get_reward_native_response_instance.to_dict() +# create an instance of GetRewardNativeResponse from a dict +get_reward_native_response_from_dict = GetRewardNativeResponse.from_dict(get_reward_native_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetStoreHourApi.md b/docs/GetStoreHourApi.md new file mode 100644 index 0000000..309b4b8 --- /dev/null +++ b/docs/GetStoreHourApi.md @@ -0,0 +1,79 @@ +# grabfood.GetStoreHourApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_store_hour**](GetStoreHourApi.md#get_store_hour) | **GET** /partner/v2/merchants/{merchantID}/store/hours | Get Store Hours + + +# **get_store_hour** +> StoreHourResponse get_store_hour(authorization, merchant_id) + +Get Store Hours + +### Example + + +```python +import grabfood +from grabfood.models.store_hour_response import StoreHourResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.GetStoreHourApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + merchant_id = '1-CYNGRUNGSBCCC' # str | The merchant's ID that is in GrabFood's database. + + try: + # Get Store Hours + api_response = api_instance.get_store_hour(authorization, merchant_id) + print("The response of GetStoreHourApi->get_store_hour:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GetStoreHourApi->get_store_hour: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **merchant_id** | **str**| The merchant's ID that is in GrabFood's database. | + +### Return type + +[**StoreHourResponse**](StoreHourResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | +**401** | Unauthorized. The access token is invalid. | - | +**5XX** | All other unexpected errors. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/GetStoreStatusApi.md b/docs/GetStoreStatusApi.md new file mode 100644 index 0000000..a9a1a53 --- /dev/null +++ b/docs/GetStoreStatusApi.md @@ -0,0 +1,79 @@ +# grabfood.GetStoreStatusApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_store_status**](GetStoreStatusApi.md#get_store_status) | **GET** /partner/v1/merchants/{merchantID}/store/status | Get Store Status + + +# **get_store_status** +> StoreStatusResponse get_store_status(authorization, merchant_id) + +Get Store Status + +### Example + + +```python +import grabfood +from grabfood.models.store_status_response import StoreStatusResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.GetStoreStatusApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + merchant_id = '1-CYNGRUNGSBCCC' # str | The merchant's ID that is in GrabFood's database. + + try: + # Get Store Status + api_response = api_instance.get_store_status(authorization, merchant_id) + print("The response of GetStoreStatusApi->get_store_status:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GetStoreStatusApi->get_store_status: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **merchant_id** | **str**| The merchant's ID that is in GrabFood's database. | + +### Return type + +[**StoreStatusResponse**](StoreStatusResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | +**401** | Unauthorized. The access token is invalid. | - | +**5XX** | All other unexpected errors. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/GrabOauthRequest.md b/docs/GrabOauthRequest.md new file mode 100644 index 0000000..5625219 --- /dev/null +++ b/docs/GrabOauthRequest.md @@ -0,0 +1,33 @@ +# GrabOauthRequest + +Information about the GrabFood client getting an OAuth 2.0 access token from partners. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client_id** | **str** | The client identifier issued to the client to obtain the OAuth 2.0 access_token. | +**client_secret** | **str** | The client secret issued to the client to obtain the OAuth 2.0 access_token. | +**grant_type** | **str** | The grant type for the client to obtain the OAuth 2.0 access_token. | +**scope** | **str** | The scope for the client to obtain the OAuth 2.0 access_token. | + +## Example + +```python +from grabfood.models.grab_oauth_request import GrabOauthRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of GrabOauthRequest from a JSON string +grab_oauth_request_instance = GrabOauthRequest.from_json(json) +# print the JSON string representation of the object +print(GrabOauthRequest.to_json()) + +# convert the object into a dict +grab_oauth_request_dict = grab_oauth_request_instance.to_dict() +# create an instance of GrabOauthRequest from a dict +grab_oauth_request_from_dict = GrabOauthRequest.from_dict(grab_oauth_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GrabOauthResponse.md b/docs/GrabOauthResponse.md new file mode 100644 index 0000000..977bca5 --- /dev/null +++ b/docs/GrabOauthResponse.md @@ -0,0 +1,31 @@ +# GrabOauthResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**access_token** | **str** | The OAuth 2.0 access token issued by the partner. | [optional] +**token_type** | **str** | The type of token issued which is case insensitive. | [optional] +**expires_in** | **int** | The access token lifespan in seconds. The token is reused till it expires - default is 604799 (7 days). | [optional] + +## Example + +```python +from grabfood.models.grab_oauth_response import GrabOauthResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of GrabOauthResponse from a JSON string +grab_oauth_response_instance = GrabOauthResponse.from_json(json) +# print the JSON string representation of the object +print(GrabOauthResponse.to_json()) + +# convert the object into a dict +grab_oauth_response_dict = grab_oauth_response_instance.to_dict() +# create an instance of GrabOauthResponse from a dict +grab_oauth_response_from_dict = GrabOauthResponse.from_dict(grab_oauth_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ListCampaignApi.md b/docs/ListCampaignApi.md new file mode 100644 index 0000000..50703e0 --- /dev/null +++ b/docs/ListCampaignApi.md @@ -0,0 +1,77 @@ +# grabfood.ListCampaignApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**list_campaign**](ListCampaignApi.md#list_campaign) | **GET** /partner/v1/campaigns | List campaigns + + +# **list_campaign** +> ListCampaignResponse list_campaign(authorization, merchant_id) + +List campaigns + +### Example + + +```python +import grabfood +from grabfood.models.list_campaign_response import ListCampaignResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.ListCampaignApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + merchant_id = '1-CYNGRUNGSBCCC' # str | The merchant's ID that is in GrabFood's database. + + try: + # List campaigns + api_response = api_instance.list_campaign(authorization, merchant_id) + print("The response of ListCampaignApi->list_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ListCampaignApi->list_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **merchant_id** | **str**| The merchant's ID that is in GrabFood's database. | + +### Return type + +[**ListCampaignResponse**](ListCampaignResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The API request is successfully processed. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/ListCampaignResponse.md b/docs/ListCampaignResponse.md new file mode 100644 index 0000000..07d8b09 --- /dev/null +++ b/docs/ListCampaignResponse.md @@ -0,0 +1,31 @@ +# ListCampaignResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ongoing** | [**List[Campaign]**](Campaign.md) | | [optional] +**upcoming** | [**List[Campaign]**](Campaign.md) | | [optional] + +## Example + +```python +from grabfood.models.list_campaign_response import ListCampaignResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ListCampaignResponse from a JSON string +list_campaign_response_instance = ListCampaignResponse.from_json(json) +# print the JSON string representation of the object +print(ListCampaignResponse.to_json()) + +# convert the object into a dict +list_campaign_response_dict = list_campaign_response_instance.to_dict() +# create an instance of ListCampaignResponse from a dict +list_campaign_response_from_dict = ListCampaignResponse.from_dict(list_campaign_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ListOrdersApi.md b/docs/ListOrdersApi.md new file mode 100644 index 0000000..9663fa1 --- /dev/null +++ b/docs/ListOrdersApi.md @@ -0,0 +1,81 @@ +# grabfood.ListOrdersApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**list_orders**](ListOrdersApi.md#list_orders) | **GET** /partner/v1/orders | List orders + + +# **list_orders** +> ListOrdersResponse list_orders(authorization, merchant_id, var_date, page) + +List orders + +### Example + + +```python +import grabfood +from grabfood.models.list_orders_response import ListOrdersResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.ListOrdersApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + merchant_id = '1-CYNGRUNGSBCCC' # str | The merchant's ID that is in GrabFood's database. + var_date = 'var_date_example' # str | + page = 1 # int | Specify the page number for the report. + + try: + # List orders + api_response = api_instance.list_orders(authorization, merchant_id, var_date, page) + print("The response of ListOrdersApi->list_orders:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ListOrdersApi->list_orders: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **merchant_id** | **str**| The merchant's ID that is in GrabFood's database. | + **var_date** | **str**| | + **page** | **int**| Specify the page number for the report. | + +### Return type + +[**ListOrdersResponse**](ListOrdersResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2xx** | Sync success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/ListOrdersResponse.md b/docs/ListOrdersResponse.md new file mode 100644 index 0000000..e9cd93c --- /dev/null +++ b/docs/ListOrdersResponse.md @@ -0,0 +1,31 @@ +# ListOrdersResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**more** | **bool** | The boolean value to indicate if there is more order data. If `true`, you can continue requesting with page+1. | [optional] +**orders** | [**List[Order]**](Order.md) | | [optional] + +## Example + +```python +from grabfood.models.list_orders_response import ListOrdersResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ListOrdersResponse from a JSON string +list_orders_response_instance = ListOrdersResponse.from_json(json) +# print the JSON string representation of the object +print(ListOrdersResponse.to_json()) + +# convert the object into a dict +list_orders_response_dict = list_orders_response_instance.to_dict() +# create an instance of ListOrdersResponse from a dict +list_orders_response_from_dict = ListOrdersResponse.from_dict(list_orders_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MarkOrderReadyApi.md b/docs/MarkOrderReadyApi.md new file mode 100644 index 0000000..215b33d --- /dev/null +++ b/docs/MarkOrderReadyApi.md @@ -0,0 +1,78 @@ +# grabfood.MarkOrderReadyApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**mark_order_ready**](MarkOrderReadyApi.md#mark_order_ready) | **POST** /partner/v1/orders/mark | Mark order as ready + + +# **mark_order_ready** +> mark_order_ready(content_type, authorization, mark_order_request) + +Mark order as ready + +### Example + + +```python +import grabfood +from grabfood.models.mark_order_request import MarkOrderRequest +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.MarkOrderReadyApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + mark_order_request = grabfood.MarkOrderRequest() # MarkOrderRequest | + + try: + # Mark order as ready + api_instance.mark_order_ready(content_type, authorization, mark_order_request) + except Exception as e: + print("Exception when calling MarkOrderReadyApi->mark_order_ready: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **mark_order_request** | [**MarkOrderRequest**](MarkOrderRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Successful. No content returned. | - | +**400** | invalid_argument | Code | Reason | Message | | ----- | ------ | ------- | | 400 | invalid_argument | invalid order state | | 400 | invalid_argument | order already marked ready| | 400 | invalid_argument | invalid markStatus: 0| | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/MarkOrderRequest.md b/docs/MarkOrderRequest.md new file mode 100644 index 0000000..5d31b6f --- /dev/null +++ b/docs/MarkOrderRequest.md @@ -0,0 +1,31 @@ +# MarkOrderRequest + +This request marks an order as ready for delivery or completed on GrabFood. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_id** | **str** | The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**mark_status** | **int** | The status to be marked accordingly. * `1` - mark order as ready * `2` - mark order as completed and only applicable to **dine-in** orders | + +## Example + +```python +from grabfood.models.mark_order_request import MarkOrderRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of MarkOrderRequest from a JSON string +mark_order_request_instance = MarkOrderRequest.from_json(json) +# print the JSON string representation of the object +print(MarkOrderRequest.to_json()) + +# convert the object into a dict +mark_order_request_dict = mark_order_request_instance.to_dict() +# create an instance of MarkOrderRequest from a dict +mark_order_request_from_dict = MarkOrderRequest.from_dict(mark_order_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuCategory.md b/docs/MenuCategory.md new file mode 100644 index 0000000..1c1a00c --- /dev/null +++ b/docs/MenuCategory.md @@ -0,0 +1,35 @@ +# MenuCategory + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The category's ID that is on the partner system. This ID should be unique. | +**name** | **str** | The name of the category. | +**name_translation** | **Dict[str, str]** | Translation of the category name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation). | [optional] +**available_status** | **str** | The status for the category. Refer to FAQs for more details about [availableStatus](#section/Menu/What-is-availableStatus). | +**selling_time_id** | **str** | The selling time's ID for the category. All items within the category will apply the same selling time unless there is another selling time specified for the item. | +**sequence** | **int** | The sort or display order of the category within the menu. | [optional] +**items** | [**List[MenuItem]**](MenuItem.md) | An array of item JSON objects. Max 300 allowed per category. Refer to [Items](#items) for more information. | + +## Example + +```python +from grabfood.models.menu_category import MenuCategory + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuCategory from a JSON string +menu_category_instance = MenuCategory.from_json(json) +# print the JSON string representation of the object +print(MenuCategory.to_json()) + +# convert the object into a dict +menu_category_dict = menu_category_instance.to_dict() +# create an instance of MenuCategory from a dict +menu_category_from_dict = MenuCategory.from_dict(menu_category_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuEntity.md b/docs/MenuEntity.md new file mode 100644 index 0000000..0a1517c --- /dev/null +++ b/docs/MenuEntity.md @@ -0,0 +1,34 @@ +# MenuEntity + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The record's ID on the partner system. For example, the item id in case type is ITEM, modifier id is MODIFIER. | [optional] +**price** | **int** | The record's price in minor unit format. | [optional] +**available_status** | **str** | The record's availableStatus. Note: In order to set an item as \"UNAVAILABLE\", it is required to update both the `availableStatus` and `maxStock` fields, whereby the `maxStock` value should be set to 0. | [optional] +**max_stock** | **int** | Available stocks under inventory for this item. Auto reduce when there is order placed for this item. Note: It is necessary to set `maxStock` to 0 if the `availableStatus` of the item is \"UNAVAILABLE\". Item will be set to \"AVAILABLE\" if `maxStock` > 0. | [optional] +**advanced_pricings** | [**List[UpdateAdvancedPricing]**](UpdateAdvancedPricing.md) | Price configuration (in minor unit) for different service, order type and channel combination. If a service type does not have a specified price, it will utilize the default price of the item. | [optional] +**purchasabilities** | [**List[UpdatePurchasability]**](UpdatePurchasability.md) | Purchasability is set to true by default for all service type, unless it is explicitly set to false. Modifier will reuse it’s item’s purchasability. | [optional] + +## Example + +```python +from grabfood.models.menu_entity import MenuEntity + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuEntity from a JSON string +menu_entity_instance = MenuEntity.from_json(json) +# print the JSON string representation of the object +print(MenuEntity.to_json()) + +# convert the object into a dict +menu_entity_dict = menu_entity_instance.to_dict() +# create an instance of MenuEntity from a dict +menu_entity_from_dict = MenuEntity.from_dict(menu_entity_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuEntityError.md b/docs/MenuEntityError.md new file mode 100644 index 0000000..e456b05 --- /dev/null +++ b/docs/MenuEntityError.md @@ -0,0 +1,30 @@ +# MenuEntityError + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**entity_id** | **str** | The itemID. | [optional] +**err_msg** | **str** | The error message. | [optional] + +## Example + +```python +from grabfood.models.menu_entity_error import MenuEntityError + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuEntityError from a JSON string +menu_entity_error_instance = MenuEntityError.from_json(json) +# print the JSON string representation of the object +print(MenuEntityError.to_json()) + +# convert the object into a dict +menu_entity_error_dict = menu_entity_error_instance.to_dict() +# create an instance of MenuEntityError from a dict +menu_entity_error_from_dict = MenuEntityError.from_dict(menu_entity_error_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuItem.md b/docs/MenuItem.md new file mode 100644 index 0000000..d978781 --- /dev/null +++ b/docs/MenuItem.md @@ -0,0 +1,45 @@ +# MenuItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The item's ID in the partner system. This ID should be unique. | +**name** | **str** | The name of the item. | +**name_translation** | **Dict[str, str]** | Translation of the item name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation). | [optional] +**available_status** | **str** | The status for the item. Refer to FAQs for more details about [availableStatus](#section/Menu/What-is-availableStatus). > Note: In order to set an item as `\"UNAVAILABLE\"`, it is required to update both the `availableStatus` and `maxStock` fields, whereby the `maxStock` should be set to 0. | +**description** | **str** | The description of the item. There is a custom length limit of 2000 for `VN`. | [optional] +**description_translation** | **Dict[str, str]** | Translation of the item description. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation). | [optional] +**price** | **int** | The item's price in minor format. For example: 1900 means $19 with `currency.exponent` as 2. Refer to [FAQ](#section/Menu/Is-the-menu-price-with-or-without-tax) to determine whether the pricing should be tax-inclusive or tax-exclusive. | +**photos** | **List[str]** | An array string for the item’s image URL link. Only 1 image is supported. Refer to FAQs for more details about [images formats](#section/Menu/What-are-the-recommended-formats-for-an-item-image). | [optional] +**special_type** | **str** | The item's special Tag. Refer to FAQs for more details about [specialType](#section/Menu/What's-specialType). | [optional] +**taxable** | **bool** | **For Indonesia only.** This field allows the configuration for an item to be marked as tax applicable, and marked item would then be included in a commercial invoice to consumers as per the government's regulations. | [optional] +**barcode** | **str** | The barcode Number (GTIN). Max 64 allowed. GTIN must be 8, 12, 13, 14 numeric digits. | [optional] +**selling_time_id** | **str** | The selling time's ID for the item. This value overrides the category's selling time if it is different. Empty value implies the category's selling time will be applied. | [optional] +**max_stock** | **int** | Available stocks under inventory for this item. Auto reduce when there is order placed for this item. Empty value implies no limit. > Note: It is necessary to set `maxStock` to 0 if the `availableStatus` of the item is `\"UNAVAILABLE\"`. Item will be set to `\"AVAILABLE\"` if `maxStock` > 0. | [optional] +**sequence** | **int** | The sort or display order of the item within the menu. | [optional] +**advanced_pricing** | [**AdvancedPricing**](AdvancedPricing.md) | | [optional] +**purchasability** | [**Purchasability**](Purchasability.md) | | [optional] +**modifier_groups** | [**List[ModifierGroup]**](ModifierGroup.md) | An array of the modifierGroup JSON objects. Max 30 allowed per item. Refer to [Modifier groups](#modifier-groups) for more information. | [optional] + +## Example + +```python +from grabfood.models.menu_item import MenuItem + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuItem from a JSON string +menu_item_instance = MenuItem.from_json(json) +# print the JSON string representation of the object +print(MenuItem.to_json()) + +# convert the object into a dict +menu_item_dict = menu_item_instance.to_dict() +# create an instance of MenuItem from a dict +menu_item_from_dict = MenuItem.from_dict(menu_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuModifier.md b/docs/MenuModifier.md new file mode 100644 index 0000000..c297b0c --- /dev/null +++ b/docs/MenuModifier.md @@ -0,0 +1,36 @@ +# MenuModifier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The modifier's ID that is on the partner's system. This ID should be unique. | +**name** | **str** | The name of the modifier. | +**name_translation** | **Dict[str, str]** | Translation of the modifier name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation). | [optional] +**available_status** | **str** | The status for the modifier. Refer to FAQs for more details about [availableStatus](#section/Menu/What-is-availableStatus). | +**price** | **int** | The modifier's price in minor format. Refer to FAQs for more details about [tax](#section/Menu/Is-the-menu-price-with-or-without-tax). | [optional] +**barcode** | **str** | The barcode Number (GTIN). GTIN must be 8, 12, 13, 14 numeric digits. | [optional] +**sequence** | **int** | The sort or display order of the modifier within the menu. | [optional] +**advanced_pricing** | [**AdvancedPricing**](AdvancedPricing.md) | | [optional] + +## Example + +```python +from grabfood.models.menu_modifier import MenuModifier + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuModifier from a JSON string +menu_modifier_instance = MenuModifier.from_json(json) +# print the JSON string representation of the object +print(MenuModifier.to_json()) + +# convert the object into a dict +menu_modifier_dict = menu_modifier_instance.to_dict() +# create an instance of MenuModifier from a dict +menu_modifier_from_dict = MenuModifier.from_dict(menu_modifier_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSection.md b/docs/MenuSection.md new file mode 100644 index 0000000..1e658b2 --- /dev/null +++ b/docs/MenuSection.md @@ -0,0 +1,32 @@ +# MenuSection + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The section's ID in the partner system. | +**name** | **str** | The name of the section. | +**service_hours** | [**ServiceHours**](ServiceHours.md) | | +**categories** | [**List[MenuSectionCategory]**](MenuSectionCategory.md) | An array of category JSON objects. Max 100 allowed per section. Refer to [Categories](#categories) for more information. | + +## Example + +```python +from grabfood.models.menu_section import MenuSection + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSection from a JSON string +menu_section_instance = MenuSection.from_json(json) +# print the JSON string representation of the object +print(MenuSection.to_json()) + +# convert the object into a dict +menu_section_dict = menu_section_instance.to_dict() +# create an instance of MenuSection from a dict +menu_section_from_dict = MenuSection.from_dict(menu_section_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSectionCategory.md b/docs/MenuSectionCategory.md new file mode 100644 index 0000000..26f1dd3 --- /dev/null +++ b/docs/MenuSectionCategory.md @@ -0,0 +1,33 @@ +# MenuSectionCategory + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The category's ID that is on the partner system. This ID should be unique with a min length of 1 and max of 64. | +**name** | **str** | The name of the category. | +**name_translation** | **Dict[str, str]** | Translation of the category name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation). | [optional] +**available_status** | **str** | The status for the category. Refer to FAQs for more details about [availableStatus](#section/Menu/What-is-availableStatus). | +**items** | [**List[MenuSectionCategoryItem]**](MenuSectionCategoryItem.md) | An array of item JSON objects. Max 300 allowed per category. Refer to [Items](#items) for more information. | + +## Example + +```python +from grabfood.models.menu_section_category import MenuSectionCategory + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSectionCategory from a JSON string +menu_section_category_instance = MenuSectionCategory.from_json(json) +# print the JSON string representation of the object +print(MenuSectionCategory.to_json()) + +# convert the object into a dict +menu_section_category_dict = menu_section_category_instance.to_dict() +# create an instance of MenuSectionCategory from a dict +menu_section_category_from_dict = MenuSectionCategory.from_dict(menu_section_category_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSectionCategoryItem.md b/docs/MenuSectionCategoryItem.md new file mode 100644 index 0000000..fcb329e --- /dev/null +++ b/docs/MenuSectionCategoryItem.md @@ -0,0 +1,43 @@ +# MenuSectionCategoryItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The item's ID in the partner system. | +**name** | **str** | The name of the item. | +**name_translation** | **Dict[str, str]** | Translation of the item name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation). | [optional] +**available_status** | **str** | The status for the item that is in the category. Refer to FAQs for more details about [availableStatus](#section/Menu/What-is-availableStatus). Note: In order to set an item as \"UNAVAILABLE\", it is required to update both the `availableStatus` and `maxStock` fields, whereby the `maxStock` value should be set to 0. | +**description** | **str** | The description of the item. There is a custom length limit of 2000 for `VN`. | [optional] +**description_translation** | **Dict[str, str]** | Translation of the item description. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation). | [optional] +**price** | **int** | The item's price (excluding tax) in minor format. For example: 1900 means $19 with `currency.exponent` as 2. Refer to [FAQ](#section/Menu/Is-the-item-price-with-or-without-tax) for more details. | +**photos** | **List[str]** | An array string for the item’s image URL links. Refer to FAQs for more details about [images](#section/Menu/What-are-the-recommended-formats-for-an-item-image). | [optional] +**special_type** | **str** | The item's special Tag. Refer to FAQs for more details about [specialType](#section/Menu/What's-specialType). | [optional] +**taxable** | **bool** | **For Indonesia only.** This field allows the configuration for an item to be marked as tax applicable, and marked item would then be included in a commercial invoice to consumers as per the government's regulations. | [optional] +**barcode** | **str** | The barcode Number (GTIN). Max 64 allowed. GTIN must be 8, 12, 13, 14 numeric digits. | [optional] +**max_stock** | **int** | Available stocks under inventory for this item. Auto reduce when there is order placed for this item. Empty value implies no limit. Note: It is necessary to set `maxStock` to 0 if the `availableStatus` of the item is \"UNAVAILABLE\". Item will be set to \"AVAILABLE\" if `maxStock` > 0. | [optional] +**advanced_pricing** | [**AdvancedPricing**](AdvancedPricing.md) | | [optional] +**purchasability** | [**Purchasability**](Purchasability.md) | | [optional] +**modifier_groups** | [**List[ModifierGroup]**](ModifierGroup.md) | An array of the modifierGroup JSON objects. Max 30 allowed per item. Refer to [Modifier groups](#modifier-groups) for more information. | [optional] + +## Example + +```python +from grabfood.models.menu_section_category_item import MenuSectionCategoryItem + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSectionCategoryItem from a JSON string +menu_section_category_item_instance = MenuSectionCategoryItem.from_json(json) +# print the JSON string representation of the object +print(MenuSectionCategoryItem.to_json()) + +# convert the object into a dict +menu_section_category_item_dict = menu_section_category_item_instance.to_dict() +# create an instance of MenuSectionCategoryItem from a dict +menu_section_category_item_from_dict = MenuSectionCategoryItem.from_dict(menu_section_category_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSyncFail.md b/docs/MenuSyncFail.md new file mode 100644 index 0000000..c6f05a5 --- /dev/null +++ b/docs/MenuSyncFail.md @@ -0,0 +1,32 @@ +# MenuSyncFail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**errors** | **List[str]** | An array of strings of error message. | [optional] +**service_hours** | [**MenuSyncFailServiceHours**](MenuSyncFailServiceHours.md) | | [optional] +**categories** | [**List[MenuSyncFailCategory]**](MenuSyncFailCategory.md) | | [optional] + +## Example + +```python +from grabfood.models.menu_sync_fail import MenuSyncFail + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSyncFail from a JSON string +menu_sync_fail_instance = MenuSyncFail.from_json(json) +# print the JSON string representation of the object +print(MenuSyncFail.to_json()) + +# convert the object into a dict +menu_sync_fail_dict = menu_sync_fail_instance.to_dict() +# create an instance of MenuSyncFail from a dict +menu_sync_fail_from_dict = MenuSyncFail.from_dict(menu_sync_fail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSyncFailCategory.md b/docs/MenuSyncFailCategory.md new file mode 100644 index 0000000..94d6b4a --- /dev/null +++ b/docs/MenuSyncFailCategory.md @@ -0,0 +1,31 @@ +# MenuSyncFailCategory + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The category's ID that is on the partner system. This ID should be unique with a min length of 1 and max of 64. | [optional] +**errors** | **List[str]** | An array of strings of error message. | [optional] +**items** | [**List[MenuSyncFailItem]**](MenuSyncFailItem.md) | An array of item JSON objects. Max 300 allowed per category. Refer to [Items](#items) for more information. | [optional] + +## Example + +```python +from grabfood.models.menu_sync_fail_category import MenuSyncFailCategory + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSyncFailCategory from a JSON string +menu_sync_fail_category_instance = MenuSyncFailCategory.from_json(json) +# print the JSON string representation of the object +print(MenuSyncFailCategory.to_json()) + +# convert the object into a dict +menu_sync_fail_category_dict = menu_sync_fail_category_instance.to_dict() +# create an instance of MenuSyncFailCategory from a dict +menu_sync_fail_category_from_dict = MenuSyncFailCategory.from_dict(menu_sync_fail_category_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSyncFailItem.md b/docs/MenuSyncFailItem.md new file mode 100644 index 0000000..905bea2 --- /dev/null +++ b/docs/MenuSyncFailItem.md @@ -0,0 +1,31 @@ +# MenuSyncFailItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The item's ID in the partner system. | [optional] +**errors** | **List[str]** | An array of strings of error message. | [optional] +**modifier_groups** | [**List[MenuSyncFailModifierGroup]**](MenuSyncFailModifierGroup.md) | | [optional] + +## Example + +```python +from grabfood.models.menu_sync_fail_item import MenuSyncFailItem + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSyncFailItem from a JSON string +menu_sync_fail_item_instance = MenuSyncFailItem.from_json(json) +# print the JSON string representation of the object +print(MenuSyncFailItem.to_json()) + +# convert the object into a dict +menu_sync_fail_item_dict = menu_sync_fail_item_instance.to_dict() +# create an instance of MenuSyncFailItem from a dict +menu_sync_fail_item_from_dict = MenuSyncFailItem.from_dict(menu_sync_fail_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSyncFailModifier.md b/docs/MenuSyncFailModifier.md new file mode 100644 index 0000000..05457e1 --- /dev/null +++ b/docs/MenuSyncFailModifier.md @@ -0,0 +1,30 @@ +# MenuSyncFailModifier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**errors** | **List[str]** | An array of strings of error message. | [optional] + +## Example + +```python +from grabfood.models.menu_sync_fail_modifier import MenuSyncFailModifier + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSyncFailModifier from a JSON string +menu_sync_fail_modifier_instance = MenuSyncFailModifier.from_json(json) +# print the JSON string representation of the object +print(MenuSyncFailModifier.to_json()) + +# convert the object into a dict +menu_sync_fail_modifier_dict = menu_sync_fail_modifier_instance.to_dict() +# create an instance of MenuSyncFailModifier from a dict +menu_sync_fail_modifier_from_dict = MenuSyncFailModifier.from_dict(menu_sync_fail_modifier_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSyncFailModifierGroup.md b/docs/MenuSyncFailModifierGroup.md new file mode 100644 index 0000000..8262953 --- /dev/null +++ b/docs/MenuSyncFailModifierGroup.md @@ -0,0 +1,31 @@ +# MenuSyncFailModifierGroup + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**errors** | **List[str]** | An array of strings of error message. | [optional] +**modifiers** | [**List[MenuSyncFailModifier]**](MenuSyncFailModifier.md) | | [optional] + +## Example + +```python +from grabfood.models.menu_sync_fail_modifier_group import MenuSyncFailModifierGroup + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSyncFailModifierGroup from a JSON string +menu_sync_fail_modifier_group_instance = MenuSyncFailModifierGroup.from_json(json) +# print the JSON string representation of the object +print(MenuSyncFailModifierGroup.to_json()) + +# convert the object into a dict +menu_sync_fail_modifier_group_dict = menu_sync_fail_modifier_group_instance.to_dict() +# create an instance of MenuSyncFailModifierGroup from a dict +menu_sync_fail_modifier_group_from_dict = MenuSyncFailModifierGroup.from_dict(menu_sync_fail_modifier_group_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSyncFailServiceHours.md b/docs/MenuSyncFailServiceHours.md new file mode 100644 index 0000000..e48896f --- /dev/null +++ b/docs/MenuSyncFailServiceHours.md @@ -0,0 +1,29 @@ +# MenuSyncFailServiceHours + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**errors** | **List[str]** | An array of strings of error message. | [optional] + +## Example + +```python +from grabfood.models.menu_sync_fail_service_hours import MenuSyncFailServiceHours + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSyncFailServiceHours from a JSON string +menu_sync_fail_service_hours_instance = MenuSyncFailServiceHours.from_json(json) +# print the JSON string representation of the object +print(MenuSyncFailServiceHours.to_json()) + +# convert the object into a dict +menu_sync_fail_service_hours_dict = menu_sync_fail_service_hours_instance.to_dict() +# create an instance of MenuSyncFailServiceHours from a dict +menu_sync_fail_service_hours_from_dict = MenuSyncFailServiceHours.from_dict(menu_sync_fail_service_hours_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSyncResponse.md b/docs/MenuSyncResponse.md new file mode 100644 index 0000000..6103b8e --- /dev/null +++ b/docs/MenuSyncResponse.md @@ -0,0 +1,34 @@ +# MenuSyncResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**created_time** | **datetime** | The Unix time the specified menu was created in GrabFood's database. | +**updated_time** | **datetime** | The Unix time the specified menu was created in GrabFood's database. | +**code** | **str** | The status code for this request. See [Menu sync response statuses](#section/Menu-sync-response-statuses) for more information. | +**errors** | **List[str]** | An array of strings of error message. | [optional] +**sections** | [**List[MenuSyncFail]**](MenuSyncFail.md) | | [optional] + +## Example + +```python +from grabfood.models.menu_sync_response import MenuSyncResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSyncResponse from a JSON string +menu_sync_response_instance = MenuSyncResponse.from_json(json) +# print the JSON string representation of the object +print(MenuSyncResponse.to_json()) + +# convert the object into a dict +menu_sync_response_dict = menu_sync_response_instance.to_dict() +# create an instance of MenuSyncResponse from a dict +menu_sync_response_from_dict = MenuSyncResponse.from_dict(menu_sync_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MenuSyncWebhookRequest.md b/docs/MenuSyncWebhookRequest.md new file mode 100644 index 0000000..09d0df9 --- /dev/null +++ b/docs/MenuSyncWebhookRequest.md @@ -0,0 +1,36 @@ +# MenuSyncWebhookRequest + +This request pushes the state of a menu sync operation. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **str** | An universally unique identifier (UUID) string. Used to uniquely identify a webhook request. Partners should use this value to distinguish between different webhook requests. If two requests contain the same requestID, only the first request should be considered and later requests **must** be ignored or discarded. | [optional] +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | [optional] +**partner_merchant_id** | **str** | The merchant's ID that is on the partner's database. | [optional] +**job_id** | **str** | An UUID string. Uniquely identifies a menu sync job. This can be found from the [Menu Update Notification](#tag/update-menu-noti) API response header. | [optional] +**updated_at** | **str** | Indicates the time of menu sync status change. This is based on ISO_8601/RFC3339. For example: `2022-07-29T15:55:59Z`. | [optional] +**status** | **str** | Indicates the state of the menu sync job. | [optional] +**errors** | **List[str]** | A string array of errors that occurred during processing. This array is empty if the status is not `FAILED`. | [optional] + +## Example + +```python +from grabfood.models.menu_sync_webhook_request import MenuSyncWebhookRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of MenuSyncWebhookRequest from a JSON string +menu_sync_webhook_request_instance = MenuSyncWebhookRequest.from_json(json) +# print the JSON string representation of the object +print(MenuSyncWebhookRequest.to_json()) + +# convert the object into a dict +menu_sync_webhook_request_dict = menu_sync_webhook_request_instance.to_dict() +# create an instance of MenuSyncWebhookRequest from a dict +menu_sync_webhook_request_from_dict = MenuSyncWebhookRequest.from_dict(menu_sync_webhook_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ModifierGroup.md b/docs/ModifierGroup.md new file mode 100644 index 0000000..86d2cbf --- /dev/null +++ b/docs/ModifierGroup.md @@ -0,0 +1,36 @@ +# ModifierGroup + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The modifier group's ID that is on the partner system. This ID should be unique. | +**name** | **str** | The name of the modifier group. | +**name_translation** | **Dict[str, str]** | Translation of the modifier group name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation). | [optional] +**available_status** | **str** | The status for the modifier group. > The item may be marked as `\"UNAVAILABLE\"` if no available modifier to be selected within the required modifier group where `\"selectionRangeMin\": 1`. | +**selection_range_min** | **int** | The minimum quantity of the modifiers to be selected. Refer to FAQs for more details about [selection range](#section/Menu/What-does-the-selection-range-do). | [optional] +**selection_range_max** | **int** | The maximum quantity of the modifiers to be selected. Refer to FAQs for more details about [selection range](#section/Menu/What-does-the-selection-range-do). | +**sequence** | **int** | The sort or display order of the modifier group within the menu. | [optional] +**modifiers** | [**List[MenuModifier]**](MenuModifier.md) | An array of modifier JSON objects. Max 100 per modifierGroup. Refer to [Modifiers](#modifiers) for more information. | [optional] + +## Example + +```python +from grabfood.models.modifier_group import ModifierGroup + +# TODO update the JSON string below +json = "{}" +# create an instance of ModifierGroup from a JSON string +modifier_group_instance = ModifierGroup.from_json(json) +# print the JSON string representation of the object +print(ModifierGroup.to_json()) + +# convert the object into a dict +modifier_group_dict = modifier_group_instance.to_dict() +# create an instance of ModifierGroup from a dict +modifier_group_from_dict = ModifierGroup.from_dict(modifier_group_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NewOrderTimeRequest.md b/docs/NewOrderTimeRequest.md new file mode 100644 index 0000000..c50dd97 --- /dev/null +++ b/docs/NewOrderTimeRequest.md @@ -0,0 +1,31 @@ +# NewOrderTimeRequest + +This request updates an order with a new ready time on GrabFood. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_id** | **str** | The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**new_order_ready_time** | **datetime** | The new order ready time for this order, based on ISO_8601/RFC3339. | + +## Example + +```python +from grabfood.models.new_order_time_request import NewOrderTimeRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of NewOrderTimeRequest from a JSON string +new_order_time_request_instance = NewOrderTimeRequest.from_json(json) +# print the JSON string representation of the object +print(NewOrderTimeRequest.to_json()) + +# convert the object into a dict +new_order_time_request_dict = new_order_time_request_instance.to_dict() +# create an instance of NewOrderTimeRequest from a dict +new_order_time_request_from_dict = NewOrderTimeRequest.from_dict(new_order_time_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NotifyMembershipWebviewApi.md b/docs/NotifyMembershipWebviewApi.md new file mode 100644 index 0000000..b598479 --- /dev/null +++ b/docs/NotifyMembershipWebviewApi.md @@ -0,0 +1,78 @@ +# grabfood.NotifyMembershipWebviewApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**notify_membership_webview**](NotifyMembershipWebviewApi.md#notify_membership_webview) | **POST** /partner/v1/membership/notify | Notify Membership + + +# **notify_membership_webview** +> notify_membership_webview(authorization, content_type, notify_membership_webview_request) + +Notify Membership + +### Example + + +```python +import grabfood +from grabfood.models.notify_membership_webview_request import NotifyMembershipWebviewRequest +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.NotifyMembershipWebviewApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + notify_membership_webview_request = grabfood.NotifyMembershipWebviewRequest() # NotifyMembershipWebviewRequest | + + try: + # Notify Membership + api_instance.notify_membership_webview(authorization, content_type, notify_membership_webview_request) + except Exception as e: + print("Exception when calling NotifyMembershipWebviewApi->notify_membership_webview: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **notify_membership_webview_request** | [**NotifyMembershipWebviewRequest**](NotifyMembershipWebviewRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Success. No content returned. | - | +**4xx** | Failed. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/NotifyMembershipWebviewRequest.md b/docs/NotifyMembershipWebviewRequest.md new file mode 100644 index 0000000..131eb20 --- /dev/null +++ b/docs/NotifyMembershipWebviewRequest.md @@ -0,0 +1,33 @@ +# NotifyMembershipWebviewRequest + +This request submits membership registration request to partner. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**member_id** | **str** | The unique member ID on the partner's database. | [optional] +**grab_id** | **str** | The id used to identify an unique grab user. | [optional] +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | [optional] +**action** | **str** | Action completed in partner's webview. | [optional] + +## Example + +```python +from grabfood.models.notify_membership_webview_request import NotifyMembershipWebviewRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of NotifyMembershipWebviewRequest from a JSON string +notify_membership_webview_request_instance = NotifyMembershipWebviewRequest.from_json(json) +# print the JSON string representation of the object +print(NotifyMembershipWebviewRequest.to_json()) + +# convert the object into a dict +notify_membership_webview_request_dict = notify_membership_webview_request_instance.to_dict() +# create an instance of NotifyMembershipWebviewRequest from a dict +notify_membership_webview_request_from_dict = NotifyMembershipWebviewRequest.from_dict(notify_membership_webview_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OpenPeriod.md b/docs/OpenPeriod.md new file mode 100644 index 0000000..7814e07 --- /dev/null +++ b/docs/OpenPeriod.md @@ -0,0 +1,30 @@ +# OpenPeriod + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_time** | **str** | The open start time in 24h format. Local time format is expected. | +**end_time** | **str** | The open end time in 24h format. Local time format is expected. | + +## Example + +```python +from grabfood.models.open_period import OpenPeriod + +# TODO update the JSON string below +json = "{}" +# create an instance of OpenPeriod from a JSON string +open_period_instance = OpenPeriod.from_json(json) +# print the JSON string representation of the object +print(OpenPeriod.to_json()) + +# convert the object into a dict +open_period_dict = open_period_instance.to_dict() +# create an instance of OpenPeriod from a dict +open_period_from_dict = OpenPeriod.from_dict(open_period_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Order.md b/docs/Order.md new file mode 100644 index 0000000..1dbaa75 --- /dev/null +++ b/docs/Order.md @@ -0,0 +1,50 @@ +# Order + +A JSON object containing the order information. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_id** | **str** | The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**short_order_number** | **str** | The GrabFood short order number. This is unique for each merchant per day. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**partner_merchant_id** | **str** | The merchant's ID that is on the partner's database. | [optional] +**payment_type** | **str** | The payment method used. Refer to FAQs for more details about [paymentType](#section/Order/Does-the-paymentType-affect-partners). | +**cutlery** | **bool** | The boolean value to indicate whether cutlery are needed or not. Refer to FAQs for more details about [cutlery](#section/Order/What-do-the-true-or-false-values-mean-for-cutlery). | +**order_time** | **str** | The UTC time that a consumer places the order, based on ISO_8601/RFC3339. | +**submit_time** | **datetime** | The order submit time, based on ISO_8601/RFC3339. `null` in Submit Order payload. Only present in the [List Orders](#tag/list-order) response. | [optional] +**complete_time** | **datetime** | The order complete time, based on ISO_8601/RFC3339. `null` in Submit Order payload. Only present in the [List Orders](#tag/list-order) response. | [optional] +**scheduled_time** | **str** | The order scheduled time, based on ISO_8601/RFC3339. Empty for non-scheduled orders. | [optional] +**order_state** | **str** | The state of the order. Empty in Submit Order payload. Only present in the [List Orders](#tag/list-order) response. Refer to [Order States](#section/Order-states). | [optional] +**currency** | [**Currency**](Currency.md) | | +**feature_flags** | [**OrderFeatureFlags**](OrderFeatureFlags.md) | | +**items** | [**List[OrderItem]**](OrderItem.md) | The ordered items in an array of JSON Object. | +**campaigns** | [**List[OrderCampaign]**](OrderCampaign.md) | The campaigns that are applicable for the order. `null` when there is no campaign applied. Only campaigns that are funded by merchants will be sent. | [optional] +**promos** | [**List[OrderPromo]**](OrderPromo.md) | An array of promotion objects. `null` when there is no promo code applied. Only promotions that are funded by merchants will be sent. | [optional] +**price** | [**OrderPrice**](OrderPrice.md) | | +**dine_in** | [**DineIn**](DineIn.md) | | [optional] +**receiver** | [**Receiver**](Receiver.md) | | [optional] +**order_ready_estimation** | [**OrderReadyEstimation**](OrderReadyEstimation.md) | | [optional] +**membership_id** | **str** | Membership ID for loyalty project. Only present for loyalty program partners. Empty if not applicable. | [optional] + +## Example + +```python +from grabfood.models.order import Order + +# TODO update the JSON string below +json = "{}" +# create an instance of Order from a JSON string +order_instance = Order.from_json(json) +# print the JSON string representation of the object +print(Order.to_json()) + +# convert the object into a dict +order_dict = order_instance.to_dict() +# create an instance of Order from a dict +order_from_dict = Order.from_dict(order_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderCampaign.md b/docs/OrderCampaign.md new file mode 100644 index 0000000..1e57318 --- /dev/null +++ b/docs/OrderCampaign.md @@ -0,0 +1,39 @@ +# OrderCampaign + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The campaign's ID returned by GrabFood upon campaign creation. | [optional] +**name** | **str** | The name of the campaign. This campaign name has been automatically generated by Grab for display in the customer app. | [optional] +**campaign_name_for_mex** | **str** | The campaign name provided by the merchant in [Create Campaign](#tag/create-campaign). Whitelist required, reach out to your integration manager. | [optional] +**level** | **str** | The campaign level. | [optional] +**type** | **str** | The type of campaign. | [optional] +**usage_count** | **int** | The redemption count of same campaign in this order. | [optional] +**mex_funded_ratio** | **int** | The ratio funded by the merchant in percentage. | [optional] +**deducted_amount** | **int** | The total discount amount in minor unit format applied to the order based on the campaign's usage count. The amount is rounded to the nearest value for `VND`, `IDR`, and `THB`, as decimals are not supported. ``` deductedAmount = Item price(tax inclusive) * 20% discount | 2375*0.2=475 | [optional] +**deducted_part** | **str** | The part that the campaign is applied. | [optional] +**applied_item_ids** | **List[str]** | An array of item IDs that get discount under this campaign. `null` if no item applied in this campaign. | [optional] +**free_item** | [**OrderFreeItem**](OrderFreeItem.md) | | [optional] + +## Example + +```python +from grabfood.models.order_campaign import OrderCampaign + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderCampaign from a JSON string +order_campaign_instance = OrderCampaign.from_json(json) +# print the JSON string representation of the object +print(OrderCampaign.to_json()) + +# convert the object into a dict +order_campaign_dict = order_campaign_instance.to_dict() +# create an instance of OrderCampaign from a dict +order_campaign_from_dict = OrderCampaign.from_dict(order_campaign_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderDeliveryRequest.md b/docs/OrderDeliveryRequest.md new file mode 100644 index 0000000..013c6d2 --- /dev/null +++ b/docs/OrderDeliveryRequest.md @@ -0,0 +1,32 @@ +# OrderDeliveryRequest + +This request marks an order as delivered on GrabFood. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_id** | **str** | The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**from_state** | **str** | Specify the order's initial state. | +**to_state** | **str** | Specify the order's new state. | + +## Example + +```python +from grabfood.models.order_delivery_request import OrderDeliveryRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderDeliveryRequest from a JSON string +order_delivery_request_instance = OrderDeliveryRequest.from_json(json) +# print the JSON string representation of the object +print(OrderDeliveryRequest.to_json()) + +# convert the object into a dict +order_delivery_request_dict = order_delivery_request_instance.to_dict() +# create an instance of OrderDeliveryRequest from a dict +order_delivery_request_from_dict = OrderDeliveryRequest.from_dict(order_delivery_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderFeatureFlags.md b/docs/OrderFeatureFlags.md new file mode 100644 index 0000000..d0d5db9 --- /dev/null +++ b/docs/OrderFeatureFlags.md @@ -0,0 +1,32 @@ +# OrderFeatureFlags + +The featureFlag JSON object containing an order's feature related information. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_accepted_type** | **str** | The acceptance type for the order. Refer to FAQs for more details about [orderAcceptedType](#section/Order/How-do-I-identify-if-a-particular-order-is-auto-or-manual-acceptance). | +**order_type** | **str** | The type of order. | +**is_mex_edit_order** | **bool** | A boolean value that indicates if the order is edited. | [optional] + +## Example + +```python +from grabfood.models.order_feature_flags import OrderFeatureFlags + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderFeatureFlags from a JSON string +order_feature_flags_instance = OrderFeatureFlags.from_json(json) +# print the JSON string representation of the object +print(OrderFeatureFlags.to_json()) + +# convert the object into a dict +order_feature_flags_dict = order_feature_flags_instance.to_dict() +# create an instance of OrderFeatureFlags from a dict +order_feature_flags_from_dict = OrderFeatureFlags.from_dict(order_feature_flags_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderFreeItem.md b/docs/OrderFreeItem.md new file mode 100644 index 0000000..2945fe0 --- /dev/null +++ b/docs/OrderFreeItem.md @@ -0,0 +1,33 @@ +# OrderFreeItem + +Free item information for `freeItem` campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The free item's externalID in the partner system. Empty if not applicable. | [optional] +**name** | **str** | The name of the free item. Empty if not applicable. | [optional] +**quantity** | **int** | The item's quantity. Maximum is **1**. | [optional] +**price** | **int** | The item's price in minor unit format. | [optional] + +## Example + +```python +from grabfood.models.order_free_item import OrderFreeItem + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderFreeItem from a JSON string +order_free_item_instance = OrderFreeItem.from_json(json) +# print the JSON string representation of the object +print(OrderFreeItem.to_json()) + +# convert the object into a dict +order_free_item_dict = order_free_item_instance.to_dict() +# create an instance of OrderFreeItem from a dict +order_free_item_from_dict = OrderFreeItem.from_dict(order_free_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderItem.md b/docs/OrderItem.md new file mode 100644 index 0000000..7d282bf --- /dev/null +++ b/docs/OrderItem.md @@ -0,0 +1,36 @@ +# OrderItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The item's externalID in the partner system. | +**grab_item_id** | **str** | The item's ID in Grab system. Partner can use this field in the `EditOrder` endpoint. | +**quantity** | **int** | The number of the item ordered. | +**price** | **int** | The price for a single item along with its associated modifiers in minor unit and tax-inclusive. ``` price = Item price(tax inclusive) + Modifier price(tax inclusive) | (2241*1.06)+(165*1.06)=2550 | +**tax** | **int** | Tax in minor format for a single item along with its associated modifiers. `0` if tax configuration is absent. Refer to FAQs for more details about [tax](#section/Order/How-is-tax-calculated). ``` tax = Item tax + Modifier tax | (2241*0.06)+(165*0.06)=144 | [optional] +**specifications** | **str** | An extra note for the merchant. Empty if no note from consumer. | [optional] +**out_of_stock_instruction** | [**OutOfStockInstruction**](OutOfStockInstruction.md) | | [optional] +**modifiers** | [**List[OrderItemModifier]**](OrderItemModifier.md) | An array of JSON objects modifiers. | [optional] + +## Example + +```python +from grabfood.models.order_item import OrderItem + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderItem from a JSON string +order_item_instance = OrderItem.from_json(json) +# print the JSON string representation of the object +print(OrderItem.to_json()) + +# convert the object into a dict +order_item_dict = order_item_instance.to_dict() +# create an instance of OrderItem from a dict +order_item_from_dict = OrderItem.from_dict(order_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderItemModifier.md b/docs/OrderItemModifier.md new file mode 100644 index 0000000..f166162 --- /dev/null +++ b/docs/OrderItemModifier.md @@ -0,0 +1,32 @@ +# OrderItemModifier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The modifier's ID that is on the partner's system. | [optional] +**price** | **int** | The modifier's price (tax-inclusive) in minor format. ``` price = round(165 * (1 + 0.06)) = 175 | [optional] +**tax** | **int** | Tax in minor format for 1 modifier. Refer to FAQs for more details about [tax](#section/Order/How-is-tax-calculated). ``` tax = 165*0.06=10 | [optional] +**quantity** | **int** | The number of modifiers present. The value is always 1. | [optional] + +## Example + +```python +from grabfood.models.order_item_modifier import OrderItemModifier + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderItemModifier from a JSON string +order_item_modifier_instance = OrderItemModifier.from_json(json) +# print the JSON string representation of the object +print(OrderItemModifier.to_json()) + +# convert the object into a dict +order_item_modifier_dict = order_item_modifier_instance.to_dict() +# create an instance of OrderItemModifier from a dict +order_item_modifier_from_dict = OrderItemModifier.from_dict(order_item_modifier_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderPrice.md b/docs/OrderPrice.md new file mode 100644 index 0000000..af613d3 --- /dev/null +++ b/docs/OrderPrice.md @@ -0,0 +1,38 @@ +# OrderPrice + +A JSON object containing order's price in the minor unit format. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**subtotal** | **int** | Total item and modifier price (tax-inclusive) in the minor unit. ``` subtotal = Sum of all (item price * quantity) | 2550*1=2550 | +**tax** | **int** | GrabFood's tax in the minor unit. Refer to FAQs for more details about [tax](#section/Order/How-is-tax-calculated). ``` tax = (subtotal + merchantChargeFee - merchantFundPromo) * Tax / (1+Tax) | (2550-475)*0.06/1.06=117 | [optional] +**merchant_charge_fee** | **int** | Any additional fee charged by merchant (tax-inclusive), which is 100% paid out to the merchant. Eg. Takeaway, packaging costs, dine-in charge. | [optional] +**grab_fund_promo** | **int** | GrabFood's promo fund in the minor unit. Calculated based on funded ratio. Only present when `paymentType:CASH` or `orderType:DeliveredByRestaurant`. Otherwise, it will be set to `0`. | [optional] +**merchant_fund_promo** | **int** | The merchant's promo fund in the minor unit. Calculated based on funded ratio. | [optional] +**basket_promo** | **int** | The total amount promo applied to the basket items only (item level/order level) in the minor unit, excluding delivery fee. Only present when `paymentType: CASH` or `orderType: DeliveredByRestaurant`. Otherwise, it will be set to `0`. ``` basketPromo = (grabFundPromo + merchantFundPromo) | 300 + 475 = 775 | [optional] +**delivery_fee** | **int** | The delivery fee in the minor unit. Only present when `paymentType:CASH` or `orderType:DeliveredByRestaurant`. Otherwise, it will be set to `0`. | [optional] +**small_order_fee** | **int** | The fee charged by GrabFood for order that does not meet a certain minimum order value. Only present when `paymentType:CASH` and `orderType:DeliveredByRestaurant`. | [optional] +**eater_payment** | **int** | The total amount paid by the consumer in the minor unit, excluding some additional fees charged by GrabFood. Only present when `paymentType:CASH` or `orderType:DeliveredByRestaurant`. Otherwise, it will be set to `0`. ``` eaterPayment = (subtotal + merchantChargeFee + deliveryFee) - (sum of all promo) | (2550+400)-775=2175 | [optional] + +## Example + +```python +from grabfood.models.order_price import OrderPrice + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderPrice from a JSON string +order_price_instance = OrderPrice.from_json(json) +# print the JSON string representation of the object +print(OrderPrice.to_json()) + +# convert the object into a dict +order_price_dict = order_price_instance.to_dict() +# create an instance of OrderPrice from a dict +order_price_from_dict = OrderPrice.from_dict(order_price_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderPromo.md b/docs/OrderPromo.md new file mode 100644 index 0000000..ff46059 --- /dev/null +++ b/docs/OrderPromo.md @@ -0,0 +1,36 @@ +# OrderPromo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Promo code applied in the order. | [optional] +**description** | **str** | Promo description. | [optional] +**name** | **str** | Name of the promotion. | [optional] +**promo_amount** | **int** | Promo amount applied in the order, in local currency. This amount is rounded into whole number. | [optional] +**mex_funded_ratio** | **int** | The merchant's funded ratio of the promo in percentage. | [optional] +**mex_funded_amount** | **int** | The merchant's promo fund in the minor unit. Calculated based on merchant funded ratio. | [optional] +**targeted_price** | **int** | The subtotal of the order basket in minor unit. | [optional] +**promo_amount_in_min** | **int** | Promo amount applied in the order in minor unit. | [optional] + +## Example + +```python +from grabfood.models.order_promo import OrderPromo + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderPromo from a JSON string +order_promo_instance = OrderPromo.from_json(json) +# print the JSON string representation of the object +print(OrderPromo.to_json()) + +# convert the object into a dict +order_promo_dict = order_promo_instance.to_dict() +# create an instance of OrderPromo from a dict +order_promo_from_dict = OrderPromo.from_dict(order_promo_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderReadyEstimation.md b/docs/OrderReadyEstimation.md new file mode 100644 index 0000000..85ffd06 --- /dev/null +++ b/docs/OrderReadyEstimation.md @@ -0,0 +1,33 @@ +# OrderReadyEstimation + +Information related to the order ready time estimation. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**allow_change** | **bool** | A boolean value indicating if the order ready time can be changed. | +**estimated_order_ready_time** | **datetime** | The order ready time for this order estimated by GrabFood, based on ISO_8601/RFC3339. | +**max_order_ready_time** | **datetime** | The max allowed order ready time for this order, based on ISO_8601/RFC3339. | +**new_order_ready_time** | **datetime** | The new order ready time for this order. Only present after a new order ready time is set (default will be null), based on ISO_8601/RFC3339. | [optional] + +## Example + +```python +from grabfood.models.order_ready_estimation import OrderReadyEstimation + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderReadyEstimation from a JSON string +order_ready_estimation_instance = OrderReadyEstimation.from_json(json) +# print the JSON string representation of the object +print(OrderReadyEstimation.to_json()) + +# convert the object into a dict +order_ready_estimation_dict = order_ready_estimation_instance.to_dict() +# create an instance of OrderReadyEstimation from a dict +order_ready_estimation_from_dict = OrderReadyEstimation.from_dict(order_ready_estimation_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderStateRequest.md b/docs/OrderStateRequest.md new file mode 100644 index 0000000..7a492e9 --- /dev/null +++ b/docs/OrderStateRequest.md @@ -0,0 +1,36 @@ +# OrderStateRequest + +This request pushes the state of an order on GrabFood. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**partner_merchant_id** | **str** | The merchant's ID that is on the partner's database. | [optional] +**order_id** | **str** | The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**state** | **str** | The current order state. For takeaway orders, only `DELIVERED` and `CANCELLED` states are pushed. | +**driver_eta** | **int** | The driver's estimated of arrival (ETA) in seconds when the state is `DRIVER_ALLOCATED`. | [optional] +**code** | **str** | The current order's sub-state. This is in free text so you should only use for reference. Grab may use this for troubleshooting. If you want some analysis, kindly use `state` instead. | [optional] +**message** | **str** | Additional information to explain the current order state. May be system status or human entered message. | [optional] + +## Example + +```python +from grabfood.models.order_state_request import OrderStateRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderStateRequest from a JSON string +order_state_request_instance = OrderStateRequest.from_json(json) +# print the JSON string representation of the object +print(OrderStateRequest.to_json()) + +# convert the object into a dict +order_state_request_dict = order_state_request_instance.to_dict() +# create an instance of OrderStateRequest from a dict +order_state_request_from_dict = OrderStateRequest.from_dict(order_state_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OutOfStockInstruction.md b/docs/OutOfStockInstruction.md new file mode 100644 index 0000000..54479a8 --- /dev/null +++ b/docs/OutOfStockInstruction.md @@ -0,0 +1,33 @@ +# OutOfStockInstruction + +An JSON object that indicates the instructions to be taken by the merchant when the item is out of stock. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | The short instruction message. | [optional] +**instruction_type** | **str** | Type of out-of-stock instruction chosen by customer. `CONTACT` is disabled by default, kindly reach out to your integration manager if you wish to receive this instruction. | [optional] +**replacement_item_id** | **str** | The preferred item's ID in the partner system. Only applicable when the instructionType is `SPECIFIC_ITEM`. | [optional] +**replacement_grab_item_id** | **str** | The preferred item's ID in the Grab system. Only applicable when the instructionType is `SPECIFIC_ITEM`. | [optional] + +## Example + +```python +from grabfood.models.out_of_stock_instruction import OutOfStockInstruction + +# TODO update the JSON string below +json = "{}" +# create an instance of OutOfStockInstruction from a JSON string +out_of_stock_instruction_instance = OutOfStockInstruction.from_json(json) +# print the JSON string representation of the object +print(OutOfStockInstruction.to_json()) + +# convert the object into a dict +out_of_stock_instruction_dict = out_of_stock_instruction_instance.to_dict() +# create an instance of OutOfStockInstruction from a dict +out_of_stock_instruction_from_dict = OutOfStockInstruction.from_dict(out_of_stock_instruction_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PartnerOauthRequest.md b/docs/PartnerOauthRequest.md new file mode 100644 index 0000000..27add02 --- /dev/null +++ b/docs/PartnerOauthRequest.md @@ -0,0 +1,33 @@ +# PartnerOauthRequest + +Information about GrabFood getting an OAuth access token from partners. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client_id** | **str** | The client identifier issued to obtain the OAuth access token. | +**client_secret** | **str** | The client secret issued to obtain the OAuth access token. | +**grant_type** | **str** | Refers to the way an application gets OAuth access token. | +**scope** | **str** | A space delimited list of partner scopes. | [optional] + +## Example + +```python +from grabfood.models.partner_oauth_request import PartnerOauthRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of PartnerOauthRequest from a JSON string +partner_oauth_request_instance = PartnerOauthRequest.from_json(json) +# print the JSON string representation of the object +print(PartnerOauthRequest.to_json()) + +# convert the object into a dict +partner_oauth_request_dict = partner_oauth_request_instance.to_dict() +# create an instance of PartnerOauthRequest from a dict +partner_oauth_request_from_dict = PartnerOauthRequest.from_dict(partner_oauth_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PartnerOauthResponse.md b/docs/PartnerOauthResponse.md new file mode 100644 index 0000000..2b7ed6a --- /dev/null +++ b/docs/PartnerOauthResponse.md @@ -0,0 +1,31 @@ +# PartnerOauthResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**access_token** | **str** | The OAuth 2.0 access token issued by the partner. | [optional] +**token_type** | **str** | The type of token issued which is case insensitive. | [optional] +**expires_in** | **int** | The access token lifespan in seconds. | [optional] + +## Example + +```python +from grabfood.models.partner_oauth_response import PartnerOauthResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of PartnerOauthResponse from a JSON string +partner_oauth_response_instance = PartnerOauthResponse.from_json(json) +# print the JSON string representation of the object +print(PartnerOauthResponse.to_json()) + +# convert the object into a dict +partner_oauth_response_dict = partner_oauth_response_instance.to_dict() +# create an instance of PartnerOauthResponse from a dict +partner_oauth_response_from_dict = PartnerOauthResponse.from_dict(partner_oauth_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PauseStoreApi.md b/docs/PauseStoreApi.md new file mode 100644 index 0000000..f579205 --- /dev/null +++ b/docs/PauseStoreApi.md @@ -0,0 +1,77 @@ +# grabfood.PauseStoreApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**pause_store**](PauseStoreApi.md#pause_store) | **PUT** /partner/v1/merchant/pause | Pause store + + +# **pause_store** +> pause_store(content_type, authorization, pause_store_request) + +Pause store + +### Example + + +```python +import grabfood +from grabfood.models.pause_store_request import PauseStoreRequest +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.PauseStoreApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + pause_store_request = grabfood.PauseStoreRequest() # PauseStoreRequest | + + try: + # Pause store + api_instance.pause_store(content_type, authorization, pause_store_request) + except Exception as e: + print("Exception when calling PauseStoreApi->pause_store: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **pause_store_request** | [**PauseStoreRequest**](PauseStoreRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Successful. No content returned. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/PauseStoreRequest.md b/docs/PauseStoreRequest.md new file mode 100644 index 0000000..5cf5969 --- /dev/null +++ b/docs/PauseStoreRequest.md @@ -0,0 +1,32 @@ +# PauseStoreRequest + +This request pauses a store temporarily for (30 minutes/1 hour/24 hours) or unpauses a store on GrabFood. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**is_pause** | **bool** | Boolean value to pause or unpause store. | +**duration** | **str** | The duration to pause the store. Only required when `isPause=true`. | [optional] + +## Example + +```python +from grabfood.models.pause_store_request import PauseStoreRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of PauseStoreRequest from a JSON string +pause_store_request_instance = PauseStoreRequest.from_json(json) +# print the JSON string representation of the object +print(PauseStoreRequest.to_json()) + +# convert the object into a dict +pause_store_request_dict = pause_store_request_instance.to_dict() +# create an instance of PauseStoreRequest from a dict +pause_store_request_from_dict = PauseStoreRequest.from_dict(pause_store_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Purchasability.md b/docs/Purchasability.md new file mode 100644 index 0000000..535483c --- /dev/null +++ b/docs/Purchasability.md @@ -0,0 +1,36 @@ +# Purchasability + +Purchasability is set to true by default for all service type, unless it is explicitly set to false. Modifier will reuse it’s item’s purchasability. Refer [Service Based Menu](#section/Service-Based-Menu). + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**delivery_on_demand_grab_app** | **bool** | | [optional] +**delivery_scheduled_grab_app** | **bool** | | [optional] +**self_pick_up_on_demand_grab_app** | **bool** | | [optional] +**dine_in_on_demand_grab_app** | **bool** | | [optional] +**delivery_on_demand_store_front** | **bool** | | [optional] +**delivery_scheduled_store_front** | **bool** | | [optional] +**self_pick_up_on_demand_store_front** | **bool** | | [optional] + +## Example + +```python +from grabfood.models.purchasability import Purchasability + +# TODO update the JSON string below +json = "{}" +# create an instance of Purchasability from a JSON string +purchasability_instance = Purchasability.from_json(json) +# print the JSON string representation of the object +print(Purchasability.to_json()) + +# convert the object into a dict +purchasability_dict = purchasability_instance.to_dict() +# create an instance of Purchasability from a dict +purchasability_from_dict = Purchasability.from_dict(purchasability_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PushIntegrationStatusWebhookRequest.md b/docs/PushIntegrationStatusWebhookRequest.md new file mode 100644 index 0000000..6105ff5 --- /dev/null +++ b/docs/PushIntegrationStatusWebhookRequest.md @@ -0,0 +1,32 @@ +# PushIntegrationStatusWebhookRequest + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**partner_merchant_id** | **str** | The merchant's ID that is on the partner's database. | +**grab_merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**integration_status** | **str** | The store integration status. - `INACTIVE`: Merchant integration deactivated - `ACTIVE`: Merchant integration activated - `SYNCING`: Merchant integration is syncing - `FAILED`: Merchant integration has failed | + +## Example + +```python +from grabfood.models.push_integration_status_webhook_request import PushIntegrationStatusWebhookRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of PushIntegrationStatusWebhookRequest from a JSON string +push_integration_status_webhook_request_instance = PushIntegrationStatusWebhookRequest.from_json(json) +# print the JSON string representation of the object +print(PushIntegrationStatusWebhookRequest.to_json()) + +# convert the object into a dict +push_integration_status_webhook_request_dict = push_integration_status_webhook_request_instance.to_dict() +# create an instance of PushIntegrationStatusWebhookRequest from a dict +push_integration_status_webhook_request_from_dict = PushIntegrationStatusWebhookRequest.from_dict(push_integration_status_webhook_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Receiver.md b/docs/Receiver.md new file mode 100644 index 0000000..9d2aab9 --- /dev/null +++ b/docs/Receiver.md @@ -0,0 +1,32 @@ +# Receiver + +A JSON object containing the receiver information. Only applicable for orders that are delivered by the restaurant. `null` if not applicable. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | The name of the receiver. | [optional] +**phones** | **str** | The receiver's phone number. | [optional] +**address** | [**Address**](Address.md) | | [optional] + +## Example + +```python +from grabfood.models.receiver import Receiver + +# TODO update the JSON string below +json = "{}" +# create an instance of Receiver from a JSON string +receiver_instance = Receiver.from_json(json) +# print the JSON string representation of the object +print(Receiver.to_json()) + +# convert the object into a dict +receiver_dict = receiver_instance.to_dict() +# create an instance of Receiver from a dict +receiver_from_dict = Receiver.from_dict(receiver_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RedeemDineInVoucherRequest.md b/docs/RedeemDineInVoucherRequest.md new file mode 100644 index 0000000..b76b41a --- /dev/null +++ b/docs/RedeemDineInVoucherRequest.md @@ -0,0 +1,31 @@ +# RedeemDineInVoucherRequest + +Dine in voucher redemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**certificate_id** | **str** | This certificateID is decoded from scanning the QR code, and 1:1 mapping with `voucherCode`. | +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | + +## Example + +```python +from grabfood.models.redeem_dine_in_voucher_request import RedeemDineInVoucherRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of RedeemDineInVoucherRequest from a JSON string +redeem_dine_in_voucher_request_instance = RedeemDineInVoucherRequest.from_json(json) +# print the JSON string representation of the object +print(RedeemDineInVoucherRequest.to_json()) + +# convert the object into a dict +redeem_dine_in_voucher_request_dict = redeem_dine_in_voucher_request_instance.to_dict() +# create an instance of RedeemDineInVoucherRequest from a dict +redeem_dine_in_voucher_request_from_dict = RedeemDineInVoucherRequest.from_dict(redeem_dine_in_voucher_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RedeemDineInVoucherResponse.md b/docs/RedeemDineInVoucherResponse.md new file mode 100644 index 0000000..797be22 --- /dev/null +++ b/docs/RedeemDineInVoucherResponse.md @@ -0,0 +1,35 @@ +# RedeemDineInVoucherResponse + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**certificate_id** | **str** | This certificateID is decoded from scanning the QR code, and 1:1 mapping with `voucherCode`. | [optional] +**voucher_code** | **str** | A short code for the dine-in voucher purchased by the user. | [optional] +**voucher** | [**Voucher**](Voucher.md) | | [optional] +**redeem_result** | [**RedeemResult**](RedeemResult.md) | | [optional] +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | [optional] +**campaign_id** | **str** | The dine-in voucher campaign's ID in GrabFood's database. | [optional] + +## Example + +```python +from grabfood.models.redeem_dine_in_voucher_response import RedeemDineInVoucherResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of RedeemDineInVoucherResponse from a JSON string +redeem_dine_in_voucher_response_instance = RedeemDineInVoucherResponse.from_json(json) +# print the JSON string representation of the object +print(RedeemDineInVoucherResponse.to_json()) + +# convert the object into a dict +redeem_dine_in_voucher_response_dict = redeem_dine_in_voucher_response_instance.to_dict() +# create an instance of RedeemDineInVoucherResponse from a dict +redeem_dine_in_voucher_response_from_dict = RedeemDineInVoucherResponse.from_dict(redeem_dine_in_voucher_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RedeemDineinVoucherApi.md b/docs/RedeemDineinVoucherApi.md new file mode 100644 index 0000000..ecb5aa5 --- /dev/null +++ b/docs/RedeemDineinVoucherApi.md @@ -0,0 +1,83 @@ +# grabfood.RedeemDineinVoucherApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**redeem_dinein_voucher**](RedeemDineinVoucherApi.md#redeem_dinein_voucher) | **POST** /partner/v1/dinein/voucher/redeem | Redeem Dine In Voucher + + +# **redeem_dinein_voucher** +> RedeemDineInVoucherResponse redeem_dinein_voucher(authorization, content_type, redeem_dine_in_voucher_request) + +Redeem Dine In Voucher + +### Example + + +```python +import grabfood +from grabfood.models.redeem_dine_in_voucher_request import RedeemDineInVoucherRequest +from grabfood.models.redeem_dine_in_voucher_response import RedeemDineInVoucherResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.RedeemDineinVoucherApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + redeem_dine_in_voucher_request = grabfood.RedeemDineInVoucherRequest() # RedeemDineInVoucherRequest | + + try: + # Redeem Dine In Voucher + api_response = api_instance.redeem_dinein_voucher(authorization, content_type, redeem_dine_in_voucher_request) + print("The response of RedeemDineinVoucherApi->redeem_dinein_voucher:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RedeemDineinVoucherApi->redeem_dinein_voucher: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **redeem_dine_in_voucher_request** | [**RedeemDineInVoucherRequest**](RedeemDineInVoucherRequest.md)| | + +### Return type + +[**RedeemDineInVoucherResponse**](RedeemDineInVoucherResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The API request is successfully processed. | - | +**400** | invalid_argument | Code | Reason | Message | Description | | ---- | ---------------- | ------------------------------------------ | --------------------------------------------------------------------------------------------------------- | | 400 | invalid_argument | invalid certificateID | The certificateID is not valid. | | 400 | invalid_argument | not enabled | The QR redemption feature is not enabled for the merchant, please reach out to the integration manager | | - | +**404** | not_found | Code | Reason | Message | Description | | -----| ----------- | ---------------------------- | ----------------------------------------------------------------------------------------------- | | 404 | not_found | voucher not found | The voucher is not found for the specified voucherCode or certificateID. | | 404 | not_found | failed to get store info | The store is not found for the specified merchantID. | | - | +**500** | internal | Code | Reason | Message | Description | | -----| ----------- | ---------------------------- | ----------------------------------------------------------------------------------------------- | | 500 | internal | redeem failed | Redemption failed, please try again later. | | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/RedeemResult.md b/docs/RedeemResult.md new file mode 100644 index 0000000..ce01157 --- /dev/null +++ b/docs/RedeemResult.md @@ -0,0 +1,31 @@ +# RedeemResult + +A JSON object containing dine-in voucher details. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | To indicate whether the dine-in voucher redemption succeeded. | [optional] +**code** | **str** | The code for the reason of failed redemption. Empty if the `success` is true. * `VOUCHER_REDEEMED` - The voucher has already been redeemed. * `INVALID_STATE` - The current status of voucher is EXPIRED or REFUNDED. * `REDEEM_FAILED` - Internal service error. * `INVALID_MERCHANT` - Voucher not applicable for this merchant. * `INVALID_ID` - Invalid certificateID. | [optional] + +## Example + +```python +from grabfood.models.redeem_result import RedeemResult + +# TODO update the JSON string below +json = "{}" +# create an instance of RedeemResult from a JSON string +redeem_result_instance = RedeemResult.from_json(json) +# print the JSON string representation of the object +print(RedeemResult.to_json()) + +# convert the object into a dict +redeem_result_dict = redeem_result_instance.to_dict() +# create an instance of RedeemResult from a dict +redeem_result_from_dict = RedeemResult.from_dict(redeem_result_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RegisterMembershipNativeRequest.md b/docs/RegisterMembershipNativeRequest.md new file mode 100644 index 0000000..323063c --- /dev/null +++ b/docs/RegisterMembershipNativeRequest.md @@ -0,0 +1,33 @@ +# RegisterMembershipNativeRequest + +This request submits membership registration request to partner. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**grab_id** | **str** | The id used to identify an unique grab user. | +**phone_number** | **str** | Grab user's phone number for registration. | [optional] +**name** | **str** | Grab user's name for registration. | [optional] +**email** | **str** | Grab user's email address for registration. | [optional] + +## Example + +```python +from grabfood.models.register_membership_native_request import RegisterMembershipNativeRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of RegisterMembershipNativeRequest from a JSON string +register_membership_native_request_instance = RegisterMembershipNativeRequest.from_json(json) +# print the JSON string representation of the object +print(RegisterMembershipNativeRequest.to_json()) + +# convert the object into a dict +register_membership_native_request_dict = register_membership_native_request_instance.to_dict() +# create an instance of RegisterMembershipNativeRequest from a dict +register_membership_native_request_from_dict = RegisterMembershipNativeRequest.from_dict(register_membership_native_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RegisterMembershipNativeResponse.md b/docs/RegisterMembershipNativeResponse.md new file mode 100644 index 0000000..5fd1af0 --- /dev/null +++ b/docs/RegisterMembershipNativeResponse.md @@ -0,0 +1,30 @@ +# RegisterMembershipNativeResponse + +This response returns membershipID after membership binding is successful. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**member_id** | **str** | The unique member ID on the partner's database. | + +## Example + +```python +from grabfood.models.register_membership_native_response import RegisterMembershipNativeResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of RegisterMembershipNativeResponse from a JSON string +register_membership_native_response_instance = RegisterMembershipNativeResponse.from_json(json) +# print the JSON string representation of the object +print(RegisterMembershipNativeResponse.to_json()) + +# convert the object into a dict +register_membership_native_response_dict = register_membership_native_response_instance.to_dict() +# create an instance of RegisterMembershipNativeResponse from a dict +register_membership_native_response_from_dict = RegisterMembershipNativeResponse.from_dict(register_membership_native_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RewardItem.md b/docs/RewardItem.md new file mode 100644 index 0000000..5f3cf02 --- /dev/null +++ b/docs/RewardItem.md @@ -0,0 +1,30 @@ +# RewardItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**item_id** | **str** | The item's ID in partner system. | [optional] +**quantity** | **int** | The item's quantity. | [optional] + +## Example + +```python +from grabfood.models.reward_item import RewardItem + +# TODO update the JSON string below +json = "{}" +# create an instance of RewardItem from a JSON string +reward_item_instance = RewardItem.from_json(json) +# print the JSON string representation of the object +print(RewardItem.to_json()) + +# convert the object into a dict +reward_item_dict = reward_item_instance.to_dict() +# create an instance of RewardItem from a dict +reward_item_from_dict = RewardItem.from_dict(reward_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SellingTime.md b/docs/SellingTime.md new file mode 100644 index 0000000..5a7456d --- /dev/null +++ b/docs/SellingTime.md @@ -0,0 +1,33 @@ +# SellingTime + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_time** | **str** | The selling time group start time in date & time format. UTC format is expected. | [optional] +**end_time** | **str** | The selling time group end time in date & time format. UTC format is expected. | [optional] +**id** | **str** | The selling time's ID on the partner system. This ID should be unique with length min 1 and max 64. | [optional] +**name** | **str** | The name of the selling time. | [optional] +**service_hours** | [**ServiceHours**](ServiceHours.md) | | [optional] + +## Example + +```python +from grabfood.models.selling_time import SellingTime + +# TODO update the JSON string below +json = "{}" +# create an instance of SellingTime from a JSON string +selling_time_instance = SellingTime.from_json(json) +# print the JSON string representation of the object +print(SellingTime.to_json()) + +# convert the object into a dict +selling_time_dict = selling_time_instance.to_dict() +# create an instance of SellingTime from a dict +selling_time_from_dict = SellingTime.from_dict(selling_time_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ServiceHour.md b/docs/ServiceHour.md new file mode 100644 index 0000000..892850c --- /dev/null +++ b/docs/ServiceHour.md @@ -0,0 +1,31 @@ +# ServiceHour + +A JSON object serviceHour for each day. An empty JSON object indicates the menu item is not available on the day. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**open_period_type** | **str** | Defines the specific time period during which the menu is available - OpenPeriod = open only in given periods - OpenAllDay = open 24 hours - CloseAllDay = closed 24 hours | +**periods** | [**List[OpenPeriod]**](OpenPeriod.md) | An array of open periods. Only required when `openPeriodType` is **OpenPeriod** | [optional] + +## Example + +```python +from grabfood.models.service_hour import ServiceHour + +# TODO update the JSON string below +json = "{}" +# create an instance of ServiceHour from a JSON string +service_hour_instance = ServiceHour.from_json(json) +# print the JSON string representation of the object +print(ServiceHour.to_json()) + +# convert the object into a dict +service_hour_dict = service_hour_instance.to_dict() +# create an instance of ServiceHour from a dict +service_hour_from_dict = ServiceHour.from_dict(service_hour_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ServiceHours.md b/docs/ServiceHours.md new file mode 100644 index 0000000..a83320d --- /dev/null +++ b/docs/ServiceHours.md @@ -0,0 +1,36 @@ +# ServiceHours + +A JSON object with serviceHours for each day of the week. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mon** | [**ServiceHour**](ServiceHour.md) | | +**tue** | [**ServiceHour**](ServiceHour.md) | | +**wed** | [**ServiceHour**](ServiceHour.md) | | +**thu** | [**ServiceHour**](ServiceHour.md) | | +**fri** | [**ServiceHour**](ServiceHour.md) | | +**sat** | [**ServiceHour**](ServiceHour.md) | | +**sun** | [**ServiceHour**](ServiceHour.md) | | + +## Example + +```python +from grabfood.models.service_hours import ServiceHours + +# TODO update the JSON string below +json = "{}" +# create an instance of ServiceHours from a JSON string +service_hours_instance = ServiceHours.from_json(json) +# print the JSON string representation of the object +print(ServiceHours.to_json()) + +# convert the object into a dict +service_hours_dict = service_hours_instance.to_dict() +# create an instance of ServiceHours from a dict +service_hours_from_dict = ServiceHours.from_dict(service_hours_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SpecialOpeningHour.md b/docs/SpecialOpeningHour.md new file mode 100644 index 0000000..d7ef246 --- /dev/null +++ b/docs/SpecialOpeningHour.md @@ -0,0 +1,32 @@ +# SpecialOpeningHour + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_date** | **str** | The start date of store special opening hours. | [optional] +**end_date** | **str** | The end date of store special opening hours. | [optional] +**metadata** | [**SpecialOpeningHourMetadata**](SpecialOpeningHourMetadata.md) | | [optional] +**opening_hours** | [**SpecialOpeningHourOpeningHours**](SpecialOpeningHourOpeningHours.md) | | [optional] + +## Example + +```python +from grabfood.models.special_opening_hour import SpecialOpeningHour + +# TODO update the JSON string below +json = "{}" +# create an instance of SpecialOpeningHour from a JSON string +special_opening_hour_instance = SpecialOpeningHour.from_json(json) +# print the JSON string representation of the object +print(SpecialOpeningHour.to_json()) + +# convert the object into a dict +special_opening_hour_dict = special_opening_hour_instance.to_dict() +# create an instance of SpecialOpeningHour from a dict +special_opening_hour_from_dict = SpecialOpeningHour.from_dict(special_opening_hour_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SpecialOpeningHourMetadata.md b/docs/SpecialOpeningHourMetadata.md new file mode 100644 index 0000000..570b76f --- /dev/null +++ b/docs/SpecialOpeningHourMetadata.md @@ -0,0 +1,30 @@ +# SpecialOpeningHourMetadata + +Contains special opening hour info. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **str** | Description of the special opening hour. | [optional] + +## Example + +```python +from grabfood.models.special_opening_hour_metadata import SpecialOpeningHourMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of SpecialOpeningHourMetadata from a JSON string +special_opening_hour_metadata_instance = SpecialOpeningHourMetadata.from_json(json) +# print the JSON string representation of the object +print(SpecialOpeningHourMetadata.to_json()) + +# convert the object into a dict +special_opening_hour_metadata_dict = special_opening_hour_metadata_instance.to_dict() +# create an instance of SpecialOpeningHourMetadata from a dict +special_opening_hour_metadata_from_dict = SpecialOpeningHourMetadata.from_dict(special_opening_hour_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SpecialOpeningHourOpeningHours.md b/docs/SpecialOpeningHourOpeningHours.md new file mode 100644 index 0000000..eee8487 --- /dev/null +++ b/docs/SpecialOpeningHourOpeningHours.md @@ -0,0 +1,31 @@ +# SpecialOpeningHourOpeningHours + +Store special opening hour period. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**open_period_type** | **str** | The period type for when the outlet is open. | [optional] +**periods** | [**List[OpenPeriod]**](OpenPeriod.md) | An array of open periods. Maximum of 3 periods. | [optional] + +## Example + +```python +from grabfood.models.special_opening_hour_opening_hours import SpecialOpeningHourOpeningHours + +# TODO update the JSON string below +json = "{}" +# create an instance of SpecialOpeningHourOpeningHours from a JSON string +special_opening_hour_opening_hours_instance = SpecialOpeningHourOpeningHours.from_json(json) +# print the JSON string representation of the object +print(SpecialOpeningHourOpeningHours.to_json()) + +# convert the object into a dict +special_opening_hour_opening_hours_dict = special_opening_hour_opening_hours_instance.to_dict() +# create an instance of SpecialOpeningHourOpeningHours from a dict +special_opening_hour_opening_hours_from_dict = SpecialOpeningHourOpeningHours.from_dict(special_opening_hour_opening_hours_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/StoreHour.md b/docs/StoreHour.md new file mode 100644 index 0000000..3fb8e48 --- /dev/null +++ b/docs/StoreHour.md @@ -0,0 +1,36 @@ +# StoreHour + +A JSON object that describes the store hour for each day. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mon** | [**List[OpenPeriod]**](OpenPeriod.md) | An array of open periods. Maximum of 3 periods. Blank indicates store close. | +**tue** | [**List[OpenPeriod]**](OpenPeriod.md) | An array of open periods. Maximum of 3 periods. Blank indicates store close. | +**wed** | [**List[OpenPeriod]**](OpenPeriod.md) | An array of open periods. Maximum of 3 periods. Blank indicates store close. | +**thu** | [**List[OpenPeriod]**](OpenPeriod.md) | An array of open periods. Maximum of 3 periods. Blank indicates store close. | +**fri** | [**List[OpenPeriod]**](OpenPeriod.md) | An array of open periods. Maximum of 3 periods. Blank indicates store close. | +**sat** | [**List[OpenPeriod]**](OpenPeriod.md) | An array of open periods. Maximum of 3 periods. Blank indicates store close. | +**sun** | [**List[OpenPeriod]**](OpenPeriod.md) | An array of open periods. Maximum of 3 periods. Blank indicates store close. | + +## Example + +```python +from grabfood.models.store_hour import StoreHour + +# TODO update the JSON string below +json = "{}" +# create an instance of StoreHour from a JSON string +store_hour_instance = StoreHour.from_json(json) +# print the JSON string representation of the object +print(StoreHour.to_json()) + +# convert the object into a dict +store_hour_dict = store_hour_instance.to_dict() +# create an instance of StoreHour from a dict +store_hour_from_dict = StoreHour.from_dict(store_hour_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/StoreHourResponse.md b/docs/StoreHourResponse.md new file mode 100644 index 0000000..87648ea --- /dev/null +++ b/docs/StoreHourResponse.md @@ -0,0 +1,32 @@ +# StoreHourResponse + +Object contain store hour info + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dine_in_hour** | [**StoreHour**](StoreHour.md) | | [optional] +**opening_hour** | [**StoreHour**](StoreHour.md) | | [optional] +**special_opening_hours** | [**List[SpecialOpeningHour]**](SpecialOpeningHour.md) | The store's special opening hours. | [optional] + +## Example + +```python +from grabfood.models.store_hour_response import StoreHourResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of StoreHourResponse from a JSON string +store_hour_response_instance = StoreHourResponse.from_json(json) +# print the JSON string representation of the object +print(StoreHourResponse.to_json()) + +# convert the object into a dict +store_hour_response_dict = store_hour_response_instance.to_dict() +# create an instance of StoreHourResponse from a dict +store_hour_response_from_dict = StoreHourResponse.from_dict(store_hour_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/StoreStatusResponse.md b/docs/StoreStatusResponse.md new file mode 100644 index 0000000..7a8ee6b --- /dev/null +++ b/docs/StoreStatusResponse.md @@ -0,0 +1,32 @@ +# StoreStatusResponse + +Object contains store status info + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**close_reason** | **str** | The code of store close reason. Blank indicates store is currently open. | +**is_in_special_opening_hour_range** | **bool** | Indicate whether the store is in special opening hour range. | +**is_open** | **bool** | Indicate whether the store is open. | + +## Example + +```python +from grabfood.models.store_status_response import StoreStatusResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of StoreStatusResponse from a JSON string +store_status_response_instance = StoreStatusResponse.from_json(json) +# print the JSON string representation of the object +print(StoreStatusResponse.to_json()) + +# convert the object into a dict +store_status_response_dict = store_status_response_instance.to_dict() +# create an instance of StoreStatusResponse from a dict +store_status_response_from_dict = StoreStatusResponse.from_dict(store_status_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SubmitOrderRequest.md b/docs/SubmitOrderRequest.md new file mode 100644 index 0000000..085c9a0 --- /dev/null +++ b/docs/SubmitOrderRequest.md @@ -0,0 +1,50 @@ +# SubmitOrderRequest + +A JSON object containing the order information. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_id** | **str** | The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**short_order_number** | **str** | The GrabFood short order number. This is unique for each merchant per day. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber). | +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**partner_merchant_id** | **str** | The merchant's ID that is on the partner's database. | [optional] +**payment_type** | **str** | The payment method used. Refer to FAQs for more details about [paymentType](#section/Order/Does-the-paymentType-affect-partners). | +**cutlery** | **bool** | The boolean value to indicate whether cutlery are needed or not. Refer to FAQs for more details about [cutlery](#section/Order/What-do-the-true-or-false-values-mean-for-cutlery). | +**order_time** | **str** | The UTC time that a consumer places the order, based on ISO_8601/RFC3339. | +**submit_time** | **datetime** | The order submit time, based on ISO_8601/RFC3339. `null` in Submit Order payload. Only present in the [List Orders](#tag/list-order) response. | [optional] +**complete_time** | **datetime** | The order complete time, based on ISO_8601/RFC3339. `null` in Submit Order payload. Only present in the [List Orders](#tag/list-order) response. | [optional] +**scheduled_time** | **str** | The order scheduled time, based on ISO_8601/RFC3339. Empty for non-scheduled orders. | [optional] +**order_state** | **str** | The state of the order. Empty in Submit Order payload. Only present in the [List Orders](#tag/list-order) response. Refer to [Order States](#section/Order-states). | [optional] +**currency** | [**Currency**](Currency.md) | | +**feature_flags** | [**OrderFeatureFlags**](OrderFeatureFlags.md) | | +**items** | [**List[OrderItem]**](OrderItem.md) | The ordered items in an array of JSON Object. | +**campaigns** | [**List[OrderCampaign]**](OrderCampaign.md) | The campaigns that are applicable for the order. `null` when there is no campaign applied. Only campaigns that are funded by merchants will be sent. | [optional] +**promos** | [**List[OrderPromo]**](OrderPromo.md) | An array of promotion objects. `null` when there is no promo code applied. Only promotions that are funded by merchants will be sent. | [optional] +**price** | [**OrderPrice**](OrderPrice.md) | | +**dine_in** | [**DineIn**](DineIn.md) | | [optional] +**receiver** | [**Receiver**](Receiver.md) | | [optional] +**order_ready_estimation** | [**OrderReadyEstimation**](OrderReadyEstimation.md) | | [optional] +**membership_id** | **str** | Membership ID for loyalty project. Only present for loyalty program partners. Empty if not applicable. | [optional] + +## Example + +```python +from grabfood.models.submit_order_request import SubmitOrderRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of SubmitOrderRequest from a JSON string +submit_order_request_instance = SubmitOrderRequest.from_json(json) +# print the JSON string representation of the object +print(SubmitOrderRequest.to_json()) + +# convert the object into a dict +submit_order_request_dict = submit_order_request_instance.to_dict() +# create an instance of SubmitOrderRequest from a dict +submit_order_request_from_dict = SubmitOrderRequest.from_dict(submit_order_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TraceMenuSyncApi.md b/docs/TraceMenuSyncApi.md new file mode 100644 index 0000000..657799c --- /dev/null +++ b/docs/TraceMenuSyncApi.md @@ -0,0 +1,78 @@ +# grabfood.TraceMenuSyncApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**trace_menu_sync**](TraceMenuSyncApi.md#trace_menu_sync) | **GET** /partner/v1/merchant/menu/trace | Trace menu sync + + +# **trace_menu_sync** +> MenuSyncResponse trace_menu_sync(authorization, merchant_id) + +Trace menu sync + +### Example + + +```python +import grabfood +from grabfood.models.menu_sync_response import MenuSyncResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.TraceMenuSyncApi(api_client) + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + merchant_id = '1-CYNGRUNGSBCCC' # str | The merchant's ID that is in GrabFood's database. + + try: + # Trace menu sync + api_response = api_instance.trace_menu_sync(authorization, merchant_id) + print("The response of TraceMenuSyncApi->trace_menu_sync:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TraceMenuSyncApi->trace_menu_sync: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **merchant_id** | **str**| The merchant's ID that is in GrabFood's database. | + +### Return type + +[**MenuSyncResponse**](MenuSyncResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Sync success or fail | - | +**4xx** | Common error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/UnbindMembershipNativeRequest.md b/docs/UnbindMembershipNativeRequest.md new file mode 100644 index 0000000..0f3326b --- /dev/null +++ b/docs/UnbindMembershipNativeRequest.md @@ -0,0 +1,30 @@ +# UnbindMembershipNativeRequest + +This request submits membership unbind request to partner. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**member_id** | **str** | The unique member ID on the partner's database. | + +## Example + +```python +from grabfood.models.unbind_membership_native_request import UnbindMembershipNativeRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of UnbindMembershipNativeRequest from a JSON string +unbind_membership_native_request_instance = UnbindMembershipNativeRequest.from_json(json) +# print the JSON string representation of the object +print(UnbindMembershipNativeRequest.to_json()) + +# convert the object into a dict +unbind_membership_native_request_dict = unbind_membership_native_request_instance.to_dict() +# create an instance of UnbindMembershipNativeRequest from a dict +unbind_membership_native_request_from_dict = UnbindMembershipNativeRequest.from_dict(unbind_membership_native_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UnlinkMembershipWebviewRequest.md b/docs/UnlinkMembershipWebviewRequest.md new file mode 100644 index 0000000..175e170 --- /dev/null +++ b/docs/UnlinkMembershipWebviewRequest.md @@ -0,0 +1,30 @@ +# UnlinkMembershipWebviewRequest + +This request submits membership unbind request to partner. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**member_id** | **str** | The unique member ID on the partner's database. | + +## Example + +```python +from grabfood.models.unlink_membership_webview_request import UnlinkMembershipWebviewRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of UnlinkMembershipWebviewRequest from a JSON string +unlink_membership_webview_request_instance = UnlinkMembershipWebviewRequest.from_json(json) +# print the JSON string representation of the object +print(UnlinkMembershipWebviewRequest.to_json()) + +# convert the object into a dict +unlink_membership_webview_request_dict = unlink_membership_webview_request_instance.to_dict() +# create an instance of UnlinkMembershipWebviewRequest from a dict +unlink_membership_webview_request_from_dict = UnlinkMembershipWebviewRequest.from_dict(unlink_membership_webview_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateAdvancedPricing.md b/docs/UpdateAdvancedPricing.md new file mode 100644 index 0000000..8976145 --- /dev/null +++ b/docs/UpdateAdvancedPricing.md @@ -0,0 +1,30 @@ +# UpdateAdvancedPricing + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **str** | Available service type. | [optional] +**price** | **int** | Price in minor unit. | [optional] + +## Example + +```python +from grabfood.models.update_advanced_pricing import UpdateAdvancedPricing + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateAdvancedPricing from a JSON string +update_advanced_pricing_instance = UpdateAdvancedPricing.from_json(json) +# print the JSON string representation of the object +print(UpdateAdvancedPricing.to_json()) + +# convert the object into a dict +update_advanced_pricing_dict = update_advanced_pricing_instance.to_dict() +# create an instance of UpdateAdvancedPricing from a dict +update_advanced_pricing_from_dict = UpdateAdvancedPricing.from_dict(update_advanced_pricing_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateCampaignApi.md b/docs/UpdateCampaignApi.md new file mode 100644 index 0000000..36bb1a9 --- /dev/null +++ b/docs/UpdateCampaignApi.md @@ -0,0 +1,79 @@ +# grabfood.UpdateCampaignApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**update_campaign**](UpdateCampaignApi.md#update_campaign) | **PUT** /partner/v1/campaigns/{campaign_id} | Update campaign + + +# **update_campaign** +> update_campaign(content_type, authorization, campaign_id, update_campaign_request) + +Update campaign + +### Example + + +```python +import grabfood +from grabfood.models.update_campaign_request import UpdateCampaignRequest +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.UpdateCampaignApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + campaign_id = 'campaign_id_example' # str | + update_campaign_request = grabfood.UpdateCampaignRequest() # UpdateCampaignRequest | + + try: + # Update campaign + api_instance.update_campaign(content_type, authorization, campaign_id, update_campaign_request) + except Exception as e: + print("Exception when calling UpdateCampaignApi->update_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **campaign_id** | **str**| | + **update_campaign_request** | [**UpdateCampaignRequest**](UpdateCampaignRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The API request is successfully processed. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/UpdateCampaignRequest.md b/docs/UpdateCampaignRequest.md new file mode 100644 index 0000000..62e527b --- /dev/null +++ b/docs/UpdateCampaignRequest.md @@ -0,0 +1,35 @@ +# UpdateCampaignRequest + +This request updates a campaign for your GrabFood store. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | [optional] +**name** | **str** | The campaign's name. | [optional] +**quotas** | [**CampaignQuotas**](CampaignQuotas.md) | | [optional] +**conditions** | [**CampaignConditions**](CampaignConditions.md) | | [optional] +**discount** | [**CampaignDiscount**](CampaignDiscount.md) | | [optional] +**custom_tag** | **str** | Specify the tag for custom bundle offer campaign. Only whitelisted partner is supported as of now. | [optional] + +## Example + +```python +from grabfood.models.update_campaign_request import UpdateCampaignRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateCampaignRequest from a JSON string +update_campaign_request_instance = UpdateCampaignRequest.from_json(json) +# print the JSON string representation of the object +print(UpdateCampaignRequest.to_json()) + +# convert the object into a dict +update_campaign_request_dict = update_campaign_request_instance.to_dict() +# create an instance of UpdateCampaignRequest from a dict +update_campaign_request_from_dict = UpdateCampaignRequest.from_dict(update_campaign_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateDeliveryHourRequest.md b/docs/UpdateDeliveryHourRequest.md new file mode 100644 index 0000000..867f66a --- /dev/null +++ b/docs/UpdateDeliveryHourRequest.md @@ -0,0 +1,31 @@ +# UpdateDeliveryHourRequest + +Object contains store delivery hours. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**opening_hour** | [**StoreHour**](StoreHour.md) | | +**force** | **bool** | To enable force update store delivery hours. Error will be returned if set to false while there is ongoing order. | + +## Example + +```python +from grabfood.models.update_delivery_hour_request import UpdateDeliveryHourRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateDeliveryHourRequest from a JSON string +update_delivery_hour_request_instance = UpdateDeliveryHourRequest.from_json(json) +# print the JSON string representation of the object +print(UpdateDeliveryHourRequest.to_json()) + +# convert the object into a dict +update_delivery_hour_request_dict = update_delivery_hour_request_instance.to_dict() +# create an instance of UpdateDeliveryHourRequest from a dict +update_delivery_hour_request_from_dict = UpdateDeliveryHourRequest.from_dict(update_delivery_hour_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateDeliveryHourResponse.md b/docs/UpdateDeliveryHourResponse.md new file mode 100644 index 0000000..e14cd55 --- /dev/null +++ b/docs/UpdateDeliveryHourResponse.md @@ -0,0 +1,33 @@ +# UpdateDeliveryHourResponse + +Object contain update store delivery hour response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error_reasons** | **List[str]** | Error message when updating store delivery hour. `null` indicates no error. | [optional] +**order_count** | **int** | Total active order for the day. | +**scheduled_order_count** | **int** | Total scheduled order during store close period. | +**close_immediately** | **bool** | Indicate the store status after updating delivery hours. | + +## Example + +```python +from grabfood.models.update_delivery_hour_response import UpdateDeliveryHourResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateDeliveryHourResponse from a JSON string +update_delivery_hour_response_instance = UpdateDeliveryHourResponse.from_json(json) +# print the JSON string representation of the object +print(UpdateDeliveryHourResponse.to_json()) + +# convert the object into a dict +update_delivery_hour_response_dict = update_delivery_hour_response_instance.to_dict() +# create an instance of UpdateDeliveryHourResponse from a dict +update_delivery_hour_response_from_dict = UpdateDeliveryHourResponse.from_dict(update_delivery_hour_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateDeliveryStateApi.md b/docs/UpdateDeliveryStateApi.md new file mode 100644 index 0000000..ea8e77c --- /dev/null +++ b/docs/UpdateDeliveryStateApi.md @@ -0,0 +1,77 @@ +# grabfood.UpdateDeliveryStateApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**update_delivery_state**](UpdateDeliveryStateApi.md#update_delivery_state) | **POST** /partner/v1/order/delivery | Update delivery state + + +# **update_delivery_state** +> update_delivery_state(content_type, authorization, order_delivery_request) + +Update delivery state + +### Example + + +```python +import grabfood +from grabfood.models.order_delivery_request import OrderDeliveryRequest +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.UpdateDeliveryStateApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + order_delivery_request = grabfood.OrderDeliveryRequest() # OrderDeliveryRequest | + + try: + # Update delivery state + api_instance.update_delivery_state(content_type, authorization, order_delivery_request) + except Exception as e: + print("Exception when calling UpdateDeliveryStateApi->update_delivery_state: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **order_delivery_request** | [**OrderDeliveryRequest**](OrderDeliveryRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Successful. No content returned. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/UpdateDineInHourRequest.md b/docs/UpdateDineInHourRequest.md new file mode 100644 index 0000000..0d542e7 --- /dev/null +++ b/docs/UpdateDineInHourRequest.md @@ -0,0 +1,30 @@ +# UpdateDineInHourRequest + +Object contains store dine-in hours. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dine_in_hour** | [**StoreHour**](StoreHour.md) | | + +## Example + +```python +from grabfood.models.update_dine_in_hour_request import UpdateDineInHourRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateDineInHourRequest from a JSON string +update_dine_in_hour_request_instance = UpdateDineInHourRequest.from_json(json) +# print the JSON string representation of the object +print(UpdateDineInHourRequest.to_json()) + +# convert the object into a dict +update_dine_in_hour_request_dict = update_dine_in_hour_request_instance.to_dict() +# create an instance of UpdateDineInHourRequest from a dict +update_dine_in_hour_request_from_dict = UpdateDineInHourRequest.from_dict(update_dine_in_hour_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateDineInHourResponse.md b/docs/UpdateDineInHourResponse.md new file mode 100644 index 0000000..83394b0 --- /dev/null +++ b/docs/UpdateDineInHourResponse.md @@ -0,0 +1,30 @@ +# UpdateDineInHourResponse + +Object contain update store dine-in hour response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error_reasons** | **List[str]** | Error message when updating store dine-in hour. `null` indicates no error. | [optional] + +## Example + +```python +from grabfood.models.update_dine_in_hour_response import UpdateDineInHourResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateDineInHourResponse from a JSON string +update_dine_in_hour_response_instance = UpdateDineInHourResponse.from_json(json) +# print the JSON string representation of the object +print(UpdateDineInHourResponse.to_json()) + +# convert the object into a dict +update_dine_in_hour_response_dict = update_dine_in_hour_response_instance.to_dict() +# create an instance of UpdateDineInHourResponse from a dict +update_dine_in_hour_response_from_dict = UpdateDineInHourResponse.from_dict(update_dine_in_hour_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateMenuItem.md b/docs/UpdateMenuItem.md new file mode 100644 index 0000000..de83ee8 --- /dev/null +++ b/docs/UpdateMenuItem.md @@ -0,0 +1,37 @@ +# UpdateMenuItem + +Information about the GrabFood client updating their food menu. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**var_field** | **str** | The record type that you want to update. | +**id** | **str** | The record's ID on the partner system. For example, the item id in case type is ITEM. | +**price** | **int** | The record's price in minor unit format. | [optional] +**available_status** | **str** | The record's availableStatus. Note: In order to set an item as \"UNAVAILABLE\", it is required to update both the `availableStatus` and `maxStock` fields, whereby the `maxStock` value should be set to 0. | [optional] +**max_stock** | **int** | Available stocks under inventory for this item. Auto reduce when there is order placed for this item. Note: It is necessary to set `maxStock` to 0 if the `availableStatus` of the item is \"UNAVAILABLE\". Item will be set to \"AVAILABLE\" if `maxStock` > 0. | [optional] +**advanced_pricings** | [**List[UpdateAdvancedPricing]**](UpdateAdvancedPricing.md) | Price configuration (in minor unit) for different service, order type and channel combination. If a service type does not have a specified price, it will utilize the default price of the item. | [optional] +**purchasabilities** | [**List[UpdatePurchasability]**](UpdatePurchasability.md) | Purchasability is set to true by default for all service type, unless it is explicitly set to false. Modifier will reuse it’s item’s purchasability. | [optional] + +## Example + +```python +from grabfood.models.update_menu_item import UpdateMenuItem + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateMenuItem from a JSON string +update_menu_item_instance = UpdateMenuItem.from_json(json) +# print the JSON string representation of the object +print(UpdateMenuItem.to_json()) + +# convert the object into a dict +update_menu_item_dict = update_menu_item_instance.to_dict() +# create an instance of UpdateMenuItem from a dict +update_menu_item_from_dict = UpdateMenuItem.from_dict(update_menu_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateMenuModifier.md b/docs/UpdateMenuModifier.md new file mode 100644 index 0000000..2b29d20 --- /dev/null +++ b/docs/UpdateMenuModifier.md @@ -0,0 +1,37 @@ +# UpdateMenuModifier + +Information about the GrabFood client updating their food menu. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**var_field** | **str** | The record type that you want to update. | +**id** | **str** | The record's ID on the partner system. For example, the modifier id in case type is MODIFIER. | +**price** | **int** | The record's price in minor unit format. | [optional] +**name** | **str** | **Only required when updating modifiers.** The record's name. Used as identifier to locate the correct record. | +**available_status** | **str** | The record's availableStatus. | [optional] +**is_free** | **bool** | Allows the modifier's price to be explicitly set as zero. Possible values are as follows: * `isFree` && `price == 0` sets the modifier's price to zero. * `isFree` && `price > 0` returns an error message that \"price cannot be set to > 0, if modifier is free”. * `!isFree` && `price > 0` sets the modifier's price to the defined price. * `!isFree` && `price == 0` does not update the modifier's price and reuses the existing price. | [optional] +**advanced_pricings** | [**List[UpdateAdvancedPricing]**](UpdateAdvancedPricing.md) | Price configuration (in minor unit) for different service, order type and channel combination. If a service type does not have a specified price, it will utilize the default price of the item. | [optional] + +## Example + +```python +from grabfood.models.update_menu_modifier import UpdateMenuModifier + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateMenuModifier from a JSON string +update_menu_modifier_instance = UpdateMenuModifier.from_json(json) +# print the JSON string representation of the object +print(UpdateMenuModifier.to_json()) + +# convert the object into a dict +update_menu_modifier_dict = update_menu_modifier_instance.to_dict() +# create an instance of UpdateMenuModifier from a dict +update_menu_modifier_from_dict = UpdateMenuModifier.from_dict(update_menu_modifier_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateMenuNotifRequest.md b/docs/UpdateMenuNotifRequest.md new file mode 100644 index 0000000..7f02d85 --- /dev/null +++ b/docs/UpdateMenuNotifRequest.md @@ -0,0 +1,30 @@ +# UpdateMenuNotifRequest + +This request notifies GrabFood about the partner's updated food menu. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | + +## Example + +```python +from grabfood.models.update_menu_notif_request import UpdateMenuNotifRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateMenuNotifRequest from a JSON string +update_menu_notif_request_instance = UpdateMenuNotifRequest.from_json(json) +# print the JSON string representation of the object +print(UpdateMenuNotifRequest.to_json()) + +# convert the object into a dict +update_menu_notif_request_dict = update_menu_notif_request_instance.to_dict() +# create an instance of UpdateMenuNotifRequest from a dict +update_menu_notif_request_from_dict = UpdateMenuNotifRequest.from_dict(update_menu_notif_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateMenuNotificationApi.md b/docs/UpdateMenuNotificationApi.md new file mode 100644 index 0000000..4c06cf6 --- /dev/null +++ b/docs/UpdateMenuNotificationApi.md @@ -0,0 +1,78 @@ +# grabfood.UpdateMenuNotificationApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**update_menu_notification**](UpdateMenuNotificationApi.md#update_menu_notification) | **POST** /partner/v1/merchant/menu/notification | Notify Grab of updated menu + + +# **update_menu_notification** +> update_menu_notification(content_type, authorization, update_menu_notif_request) + +Notify Grab of updated menu + +### Example + + +```python +import grabfood +from grabfood.models.update_menu_notif_request import UpdateMenuNotifRequest +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.UpdateMenuNotificationApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + update_menu_notif_request = grabfood.UpdateMenuNotifRequest() # UpdateMenuNotifRequest | + + try: + # Notify Grab of updated menu + api_instance.update_menu_notification(content_type, authorization, update_menu_notif_request) + except Exception as e: + print("Exception when calling UpdateMenuNotificationApi->update_menu_notification: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **update_menu_notif_request** | [**UpdateMenuNotifRequest**](UpdateMenuNotifRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Successful. No Content returned. | * x-job-id - Uniquely identifies a menu sync job. Please mention this value while raising any issues on [Menu sync state webhook](#tag/menu-sync-state-webhook).
| +**4XX** | invalid_argument Fail example with code and reason. | Code | Reason | Message | | -----| --------------- | -------------------------------------------------- | | 409 | invalid_argument | sync menu too frequently, retry after 120 seconds | > Note: A distributed interval lock mechanism with a default duration of 120 seconds is in place for the same requests sent. The lock duration is customizable and may vary across different partners. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/UpdateMenuRecordApi.md b/docs/UpdateMenuRecordApi.md new file mode 100644 index 0000000..056ed1c --- /dev/null +++ b/docs/UpdateMenuRecordApi.md @@ -0,0 +1,152 @@ +# grabfood.UpdateMenuRecordApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**batch_update_menu**](UpdateMenuRecordApi.md#batch_update_menu) | **PUT** /partner/v1/batch/menu | Batch Update Menu +[**update_menu**](UpdateMenuRecordApi.md#update_menu) | **PUT** /partner/v1/menu | Update menu record + + +# **batch_update_menu** +> BatchUpdateMenuResponse batch_update_menu(content_type, authorization, batch_update_menu_item) + +Batch Update Menu + +### Example + + +```python +import grabfood +from grabfood.models.batch_update_menu_item import BatchUpdateMenuItem +from grabfood.models.batch_update_menu_response import BatchUpdateMenuResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.UpdateMenuRecordApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + batch_update_menu_item = grabfood.BatchUpdateMenuItem() # BatchUpdateMenuItem | + + try: + # Batch Update Menu + api_response = api_instance.batch_update_menu(content_type, authorization, batch_update_menu_item) + print("The response of UpdateMenuRecordApi->batch_update_menu:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UpdateMenuRecordApi->batch_update_menu: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **batch_update_menu_item** | [**BatchUpdateMenuItem**](BatchUpdateMenuItem.md)| | + +### Return type + +[**BatchUpdateMenuResponse**](BatchUpdateMenuResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The API request is successfully processed. Refer to status and errors for more info. | - | +**400** | invalid_argument | Description | | ----------- | | Invalid parameter | | Batch update menu support at most 200 items | | - | +**409** | conflict. BatchUpdate ITEM xxx too frequently, retry after 10 seconds | - | +**429** | Too Many Requests | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_menu** +> update_menu(content_type, authorization, update_menu_request) + +Update menu record + +### Example + + +```python +import grabfood +from grabfood.models.update_menu_request import UpdateMenuRequest +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.UpdateMenuRecordApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + update_menu_request = grabfood.UpdateMenuRequest() # UpdateMenuRequest | + + try: + # Update menu record + api_instance.update_menu(content_type, authorization, update_menu_request) + except Exception as e: + print("Exception when calling UpdateMenuRecordApi->update_menu: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **update_menu_request** | [**UpdateMenuRequest**](UpdateMenuRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Successful. No Content returned. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/UpdateMenuRequest.md b/docs/UpdateMenuRequest.md new file mode 100644 index 0000000..9046198 --- /dev/null +++ b/docs/UpdateMenuRequest.md @@ -0,0 +1,38 @@ +# UpdateMenuRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merchant_id** | **str** | The merchant's ID that is in GrabFood's database. | +**var_field** | **str** | The record type that you want to update. | +**id** | **str** | The record's ID on the partner system. For example, the modifier id in case type is MODIFIER. | +**price** | **int** | The record's price in minor unit format. | [optional] +**available_status** | **str** | The record's availableStatus. | [optional] +**max_stock** | **int** | Available stocks under inventory for this item. Auto reduce when there is order placed for this item. Note: It is necessary to set `maxStock` to 0 if the `availableStatus` of the item is \"UNAVAILABLE\". Item will be set to \"AVAILABLE\" if `maxStock` > 0. | [optional] +**advanced_pricings** | [**List[UpdateAdvancedPricing]**](UpdateAdvancedPricing.md) | Price configuration (in minor unit) for different service, order type and channel combination. If a service type does not have a specified price, it will utilize the default price of the item. | [optional] +**purchasabilities** | [**List[UpdatePurchasability]**](UpdatePurchasability.md) | Purchasability is set to true by default for all service type, unless it is explicitly set to false. Modifier will reuse it’s item’s purchasability. | [optional] +**name** | **str** | **Only required when updating modifiers.** The record's name. Used as identifier to locate the correct record. | +**is_free** | **bool** | Allows the modifier's price to be explicitly set as zero. Possible values are as follows: * `isFree` && `price == 0` sets the modifier's price to zero. * `isFree` && `price > 0` returns an error message that \"price cannot be set to > 0, if modifier is free”. * `!isFree` && `price > 0` sets the modifier's price to the defined price. * `!isFree` && `price == 0` does not update the modifier's price and reuses the existing price. | [optional] + +## Example + +```python +from grabfood.models.update_menu_request import UpdateMenuRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateMenuRequest from a JSON string +update_menu_request_instance = UpdateMenuRequest.from_json(json) +# print the JSON string representation of the object +print(UpdateMenuRequest.to_json()) + +# convert the object into a dict +update_menu_request_dict = update_menu_request_instance.to_dict() +# create an instance of UpdateMenuRequest from a dict +update_menu_request_from_dict = UpdateMenuRequest.from_dict(update_menu_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateOrderReadyTimeApi.md b/docs/UpdateOrderReadyTimeApi.md new file mode 100644 index 0000000..4739666 --- /dev/null +++ b/docs/UpdateOrderReadyTimeApi.md @@ -0,0 +1,78 @@ +# grabfood.UpdateOrderReadyTimeApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**update_order_ready_time**](UpdateOrderReadyTimeApi.md#update_order_ready_time) | **PUT** /partner/v1/order/readytime | Update new order ready time + + +# **update_order_ready_time** +> update_order_ready_time(content_type, authorization, new_order_time_request) + +Update new order ready time + +### Example + + +```python +import grabfood +from grabfood.models.new_order_time_request import NewOrderTimeRequest +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.UpdateOrderReadyTimeApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + new_order_time_request = grabfood.NewOrderTimeRequest() # NewOrderTimeRequest | + + try: + # Update new order ready time + api_instance.update_order_ready_time(content_type, authorization, new_order_time_request) + except Exception as e: + print("Exception when calling UpdateOrderReadyTimeApi->update_order_ready_time: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **new_order_time_request** | [**NewOrderTimeRequest**](NewOrderTimeRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Successful. No content returned. | - | +**400** | invalid_argument | Code | Reason | Message | | ----- | ----- | ------- | | 400 | invalid_argument | invalid new order ready time | | 400 | invalid_argument | order ready time not allowed to change | | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/UpdatePurchasability.md b/docs/UpdatePurchasability.md new file mode 100644 index 0000000..e31a349 --- /dev/null +++ b/docs/UpdatePurchasability.md @@ -0,0 +1,30 @@ +# UpdatePurchasability + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **str** | Available service type. | [optional] +**purchasable** | **bool** | | [optional] + +## Example + +```python +from grabfood.models.update_purchasability import UpdatePurchasability + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdatePurchasability from a JSON string +update_purchasability_instance = UpdatePurchasability.from_json(json) +# print the JSON string representation of the object +print(UpdatePurchasability.to_json()) + +# convert the object into a dict +update_purchasability_dict = update_purchasability_instance.to_dict() +# create an instance of UpdatePurchasability from a dict +update_purchasability_from_dict = UpdatePurchasability.from_dict(update_purchasability_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateSpecialHourRequest.md b/docs/UpdateSpecialHourRequest.md new file mode 100644 index 0000000..5e50ae6 --- /dev/null +++ b/docs/UpdateSpecialHourRequest.md @@ -0,0 +1,30 @@ +# UpdateSpecialHourRequest + +Object contains store special hours. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**special_opening_hours** | [**List[SpecialOpeningHour]**](SpecialOpeningHour.md) | An array of objects contain store special hours. Max. 3 array elements. | + +## Example + +```python +from grabfood.models.update_special_hour_request import UpdateSpecialHourRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateSpecialHourRequest from a JSON string +update_special_hour_request_instance = UpdateSpecialHourRequest.from_json(json) +# print the JSON string representation of the object +print(UpdateSpecialHourRequest.to_json()) + +# convert the object into a dict +update_special_hour_request_dict = update_special_hour_request_instance.to_dict() +# create an instance of UpdateSpecialHourRequest from a dict +update_special_hour_request_from_dict = UpdateSpecialHourRequest.from_dict(update_special_hour_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateSpecialHourResponse.md b/docs/UpdateSpecialHourResponse.md new file mode 100644 index 0000000..383cf97 --- /dev/null +++ b/docs/UpdateSpecialHourResponse.md @@ -0,0 +1,33 @@ +# UpdateSpecialHourResponse + +Object contain update store special hour response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error_reasons** | **List[str]** | Error message when updating store delivery hour. `null` indicates no error. | [optional] +**order_count** | **int** | Total active order for the day. | +**scheduled_order_count** | **int** | Total scheduled order during store close period. | +**close_immediately** | **bool** | Indicate the store status after updating special hours. | + +## Example + +```python +from grabfood.models.update_special_hour_response import UpdateSpecialHourResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateSpecialHourResponse from a JSON string +update_special_hour_response_instance = UpdateSpecialHourResponse.from_json(json) +# print the JSON string representation of the object +print(UpdateSpecialHourResponse.to_json()) + +# convert the object into a dict +update_special_hour_response_dict = update_special_hour_response_instance.to_dict() +# create an instance of UpdateSpecialHourResponse from a dict +update_special_hour_response_from_dict = UpdateSpecialHourResponse.from_dict(update_special_hour_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateStoreDeliveryHourApi.md b/docs/UpdateStoreDeliveryHourApi.md new file mode 100644 index 0000000..63b5cb7 --- /dev/null +++ b/docs/UpdateStoreDeliveryHourApi.md @@ -0,0 +1,84 @@ +# grabfood.UpdateStoreDeliveryHourApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**update_store_delivery_hour**](UpdateStoreDeliveryHourApi.md#update_store_delivery_hour) | **PUT** /partner/v1/merchants/{merchantID}/store/opening-hours | Update Store Delivery Hours + + +# **update_store_delivery_hour** +> UpdateDeliveryHourResponse update_store_delivery_hour(content_type, authorization, merchant_id, update_delivery_hour_request) + +Update Store Delivery Hours + +### Example + + +```python +import grabfood +from grabfood.models.update_delivery_hour_request import UpdateDeliveryHourRequest +from grabfood.models.update_delivery_hour_response import UpdateDeliveryHourResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.UpdateStoreDeliveryHourApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + merchant_id = '1-CYNGRUNGSBCCC' # str | The merchant's ID that is in GrabFood's database. + update_delivery_hour_request = grabfood.UpdateDeliveryHourRequest() # UpdateDeliveryHourRequest | + + try: + # Update Store Delivery Hours + api_response = api_instance.update_store_delivery_hour(content_type, authorization, merchant_id, update_delivery_hour_request) + print("The response of UpdateStoreDeliveryHourApi->update_store_delivery_hour:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UpdateStoreDeliveryHourApi->update_store_delivery_hour: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **merchant_id** | **str**| The merchant's ID that is in GrabFood's database. | + **update_delivery_hour_request** | [**UpdateDeliveryHourRequest**](UpdateDeliveryHourRequest.md)| | + +### Return type + +[**UpdateDeliveryHourResponse**](UpdateDeliveryHourResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | +**401** | Unauthorized. The access token is invalid. | - | +**5XX** | All other unexpected errors. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/UpdateStoreDineInHourApi.md b/docs/UpdateStoreDineInHourApi.md new file mode 100644 index 0000000..007549b --- /dev/null +++ b/docs/UpdateStoreDineInHourApi.md @@ -0,0 +1,84 @@ +# grabfood.UpdateStoreDineInHourApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**update_store_dine_in_hour**](UpdateStoreDineInHourApi.md#update_store_dine_in_hour) | **PUT** /partner/v1/merchants/{merchantID}/store/dine-in-hours | Update Store Dine-in Hours + + +# **update_store_dine_in_hour** +> UpdateDineInHourResponse update_store_dine_in_hour(content_type, authorization, merchant_id, update_dine_in_hour_request) + +Update Store Dine-in Hours + +### Example + + +```python +import grabfood +from grabfood.models.update_dine_in_hour_request import UpdateDineInHourRequest +from grabfood.models.update_dine_in_hour_response import UpdateDineInHourResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.UpdateStoreDineInHourApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + merchant_id = '1-CYNGRUNGSBCCC' # str | The merchant's ID that is in GrabFood's database. + update_dine_in_hour_request = grabfood.UpdateDineInHourRequest() # UpdateDineInHourRequest | + + try: + # Update Store Dine-in Hours + api_response = api_instance.update_store_dine_in_hour(content_type, authorization, merchant_id, update_dine_in_hour_request) + print("The response of UpdateStoreDineInHourApi->update_store_dine_in_hour:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UpdateStoreDineInHourApi->update_store_dine_in_hour: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **merchant_id** | **str**| The merchant's ID that is in GrabFood's database. | + **update_dine_in_hour_request** | [**UpdateDineInHourRequest**](UpdateDineInHourRequest.md)| | + +### Return type + +[**UpdateDineInHourResponse**](UpdateDineInHourResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | +**401** | Unauthorized. The access token is invalid. | - | +**5XX** | All other unexpected errors. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/UpdateStoreSpecialHourApi.md b/docs/UpdateStoreSpecialHourApi.md new file mode 100644 index 0000000..68551ad --- /dev/null +++ b/docs/UpdateStoreSpecialHourApi.md @@ -0,0 +1,84 @@ +# grabfood.UpdateStoreSpecialHourApi + +All URIs are relative to *https://partner-api.grab.com/grabfood-sandbox* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**update_store_special_hour**](UpdateStoreSpecialHourApi.md#update_store_special_hour) | **PUT** /partner/v2/merchants/{merchantID}/store/special-opening-hour | Update Store Special Hours + + +# **update_store_special_hour** +> UpdateSpecialHourResponse update_store_special_hour(content_type, authorization, merchant_id, update_special_hour_request) + +Update Store Special Hours + +### Example + + +```python +import grabfood +from grabfood.models.update_special_hour_request import UpdateSpecialHourRequest +from grabfood.models.update_special_hour_response import UpdateSpecialHourResponse +from grabfood.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://partner-api.grab.com/grabfood-sandbox +# See configuration.py for a list of all supported configuration parameters. +configuration = grabfood.Configuration( + host = "https://partner-api.grab.com/grabfood-sandbox" +) + + +# Enter a context with an instance of the API client +with grabfood.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = grabfood.UpdateStoreSpecialHourApi(api_client) + content_type = 'application/json' # str | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. + authorization = 'Bearer ' # str | Specify the generated authorization token of the bearer type. + merchant_id = '1-CYNGRUNGSBCCC' # str | The merchant's ID that is in GrabFood's database. + update_special_hour_request = grabfood.UpdateSpecialHourRequest() # UpdateSpecialHourRequest | + + try: + # Update Store Special Hours + api_response = api_instance.update_store_special_hour(content_type, authorization, merchant_id, update_special_hour_request) + print("The response of UpdateStoreSpecialHourApi->update_store_special_hour:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UpdateStoreSpecialHourApi->update_store_special_hour: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content_type** | **str**| The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. | + **authorization** | **str**| Specify the generated authorization token of the bearer type. | + **merchant_id** | **str**| The merchant's ID that is in GrabFood's database. | + **update_special_hour_request** | [**UpdateSpecialHourRequest**](UpdateSpecialHourRequest.md)| | + +### Return type + +[**UpdateSpecialHourResponse**](UpdateSpecialHourResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | +**401** | Unauthorized. The access token is invalid. | - | +**5XX** | All other unexpected errors. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Voucher.md b/docs/Voucher.md new file mode 100644 index 0000000..cb258c9 --- /dev/null +++ b/docs/Voucher.md @@ -0,0 +1,34 @@ +# Voucher + +A JSON object containing dine-in voucher details. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | The title of the voucher. | [optional] +**discounted_price** | **str** | The amount paid after discount is applied in local currency. | [optional] +**original_price** | **str** | The original amount before discount is applied in local currency. | [optional] +**description_info** | [**VoucherDescriptionInfo**](VoucherDescriptionInfo.md) | | [optional] +**voucher_type** | **str** | The type of the dine-in voucher. | [optional] + +## Example + +```python +from grabfood.models.voucher import Voucher + +# TODO update the JSON string below +json = "{}" +# create an instance of Voucher from a JSON string +voucher_instance = Voucher.from_json(json) +# print the JSON string representation of the object +print(Voucher.to_json()) + +# convert the object into a dict +voucher_dict = voucher_instance.to_dict() +# create an instance of Voucher from a dict +voucher_from_dict = Voucher.from_dict(voucher_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/VoucherDescriptionInfo.md b/docs/VoucherDescriptionInfo.md new file mode 100644 index 0000000..323c025 --- /dev/null +++ b/docs/VoucherDescriptionInfo.md @@ -0,0 +1,30 @@ +# VoucherDescriptionInfo + +A JSON object containing dine-in voucher's description information. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**text** | **str** | The description of the dine-in voucher. | [optional] + +## Example + +```python +from grabfood.models.voucher_description_info import VoucherDescriptionInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of VoucherDescriptionInfo from a JSON string +voucher_description_info_instance = VoucherDescriptionInfo.from_json(json) +# print the JSON string representation of the object +print(VoucherDescriptionInfo.to_json()) + +# convert the object into a dict +voucher_description_info_dict = voucher_description_info_instance.to_dict() +# create an instance of VoucherDescriptionInfo from a dict +voucher_description_info_from_dict = VoucherDescriptionInfo.from_dict(voucher_description_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WorkingHour.md b/docs/WorkingHour.md new file mode 100644 index 0000000..f940f19 --- /dev/null +++ b/docs/WorkingHour.md @@ -0,0 +1,36 @@ +# WorkingHour + +A JSON object that describes the workingHour for each day. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sun** | [**WorkingHourDay**](WorkingHourDay.md) | | [optional] +**mon** | [**WorkingHourDay**](WorkingHourDay.md) | | [optional] +**tue** | [**WorkingHourDay**](WorkingHourDay.md) | | [optional] +**wed** | [**WorkingHourDay**](WorkingHourDay.md) | | [optional] +**thu** | [**WorkingHourDay**](WorkingHourDay.md) | | [optional] +**fri** | [**WorkingHourDay**](WorkingHourDay.md) | | [optional] +**sat** | [**WorkingHourDay**](WorkingHourDay.md) | | [optional] + +## Example + +```python +from grabfood.models.working_hour import WorkingHour + +# TODO update the JSON string below +json = "{}" +# create an instance of WorkingHour from a JSON string +working_hour_instance = WorkingHour.from_json(json) +# print the JSON string representation of the object +print(WorkingHour.to_json()) + +# convert the object into a dict +working_hour_dict = working_hour_instance.to_dict() +# create an instance of WorkingHour from a dict +working_hour_from_dict = WorkingHour.from_dict(working_hour_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WorkingHourDay.md b/docs/WorkingHourDay.md new file mode 100644 index 0000000..66a2d69 --- /dev/null +++ b/docs/WorkingHourDay.md @@ -0,0 +1,30 @@ +# WorkingHourDay + +A JSON object for workingHour for a day. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**periods** | [**List[OpenPeriod]**](OpenPeriod.md) | An array of open periods. `null` if the campaign period is closed all day. | [optional] + +## Example + +```python +from grabfood.models.working_hour_day import WorkingHourDay + +# TODO update the JSON string below +json = "{}" +# create an instance of WorkingHourDay from a JSON string +working_hour_day_instance = WorkingHourDay.from_json(json) +# print the JSON string representation of the object +print(WorkingHourDay.to_json()) + +# convert the object into a dict +working_hour_day_dict = working_hour_day_instance.to_dict() +# create an instance of WorkingHourDay from a dict +working_hour_day_from_dict = WorkingHourDay.from_dict(working_hour_day_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/grabfood/__init__.py b/grabfood/__init__.py new file mode 100644 index 0000000..47fb69a --- /dev/null +++ b/grabfood/__init__.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +# flake8: noqa + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +__version__ = "1.0.1" + +# import apis into sdk package +from grabfood.api.accept_reject_order_api import AcceptRejectOrderApi +from grabfood.api.cancel_order_api import CancelOrderApi +from grabfood.api.check_order_cancelable_api import CheckOrderCancelableApi +from grabfood.api.create_campaign_api import CreateCampaignApi +from grabfood.api.create_self_serve_journey_api import CreateSelfServeJourneyApi +from grabfood.api.delete_campaign_api import DeleteCampaignApi +from grabfood.api.edit_order_api import EditOrderApi +from grabfood.api.get_dinein_voucher_api import GetDineinVoucherApi +from grabfood.api.get_oauth_grab_api import GetOauthGrabApi +from grabfood.api.get_store_hour_api import GetStoreHourApi +from grabfood.api.get_store_status_api import GetStoreStatusApi +from grabfood.api.list_campaign_api import ListCampaignApi +from grabfood.api.list_orders_api import ListOrdersApi +from grabfood.api.mark_order_ready_api import MarkOrderReadyApi +from grabfood.api.notify_membership_webview_api import NotifyMembershipWebviewApi +from grabfood.api.pause_store_api import PauseStoreApi +from grabfood.api.redeem_dinein_voucher_api import RedeemDineinVoucherApi +from grabfood.api.trace_menu_sync_api import TraceMenuSyncApi +from grabfood.api.update_campaign_api import UpdateCampaignApi +from grabfood.api.update_delivery_state_api import UpdateDeliveryStateApi +from grabfood.api.update_menu_notification_api import UpdateMenuNotificationApi +from grabfood.api.update_menu_record_api import UpdateMenuRecordApi +from grabfood.api.update_order_ready_time_api import UpdateOrderReadyTimeApi +from grabfood.api.update_store_delivery_hour_api import UpdateStoreDeliveryHourApi +from grabfood.api.update_store_dine_in_hour_api import UpdateStoreDineInHourApi +from grabfood.api.update_store_special_hour_api import UpdateStoreSpecialHourApi + +# import ApiClient +from grabfood.api_response import ApiResponse +from grabfood.api_client import ApiClient +from grabfood.configuration import Configuration +from grabfood.exceptions import OpenApiException +from grabfood.exceptions import ApiTypeError +from grabfood.exceptions import ApiValueError +from grabfood.exceptions import ApiKeyError +from grabfood.exceptions import ApiAttributeError +from grabfood.exceptions import ApiException + +# import models into sdk package +from grabfood.models.accept_order_request import AcceptOrderRequest +from grabfood.models.address import Address +from grabfood.models.advanced_pricing import AdvancedPricing +from grabfood.models.batch_update_menu_item import BatchUpdateMenuItem +from grabfood.models.batch_update_menu_response import BatchUpdateMenuResponse +from grabfood.models.bind_membership_native_request import BindMembershipNativeRequest +from grabfood.models.bind_membership_native_response import BindMembershipNativeResponse +from grabfood.models.campaign import Campaign +from grabfood.models.campaign_conditions import CampaignConditions +from grabfood.models.campaign_discount import CampaignDiscount +from grabfood.models.campaign_quotas import CampaignQuotas +from grabfood.models.campaign_scope import CampaignScope +from grabfood.models.cancel_code import CancelCode +from grabfood.models.cancel_order_limit_type import CancelOrderLimitType +from grabfood.models.cancel_order_request import CancelOrderRequest +from grabfood.models.cancel_order_response import CancelOrderResponse +from grabfood.models.cancel_reason import CancelReason +from grabfood.models.check_order_cancelable_response import CheckOrderCancelableResponse +from grabfood.models.coordinates import Coordinates +from grabfood.models.create_campaign_request import CreateCampaignRequest +from grabfood.models.create_campaign_response import CreateCampaignResponse +from grabfood.models.create_self_serve_journey_request import CreateSelfServeJourneyRequest +from grabfood.models.create_self_serve_journey_request_partner import CreateSelfServeJourneyRequestPartner +from grabfood.models.create_self_serve_journey_response import CreateSelfServeJourneyResponse +from grabfood.models.currency import Currency +from grabfood.models.dine_in import DineIn +from grabfood.models.edit_order_item import EditOrderItem +from grabfood.models.edit_order_request import EditOrderRequest +from grabfood.models.error import Error +from grabfood.models.get_dine_in_voucher_response import GetDineInVoucherResponse +from grabfood.models.get_membership_native_response import GetMembershipNativeResponse +from grabfood.models.get_membership_native_response_point_info import GetMembershipNativeResponsePointInfo +from grabfood.models.get_membership_request import GetMembershipRequest +from grabfood.models.get_membership_webview_response import GetMembershipWebviewResponse +from grabfood.models.get_menu_new_response import GetMenuNewResponse +from grabfood.models.get_menu_old_response import GetMenuOldResponse +from grabfood.models.get_reward_native_request import GetRewardNativeRequest +from grabfood.models.get_reward_native_response import GetRewardNativeResponse +from grabfood.models.grab_oauth_request import GrabOauthRequest +from grabfood.models.grab_oauth_response import GrabOauthResponse +from grabfood.models.list_campaign_response import ListCampaignResponse +from grabfood.models.list_orders_response import ListOrdersResponse +from grabfood.models.mark_order_request import MarkOrderRequest +from grabfood.models.menu_category import MenuCategory +from grabfood.models.menu_entity import MenuEntity +from grabfood.models.menu_entity_error import MenuEntityError +from grabfood.models.menu_item import MenuItem +from grabfood.models.menu_modifier import MenuModifier +from grabfood.models.menu_section import MenuSection +from grabfood.models.menu_section_category import MenuSectionCategory +from grabfood.models.menu_section_category_item import MenuSectionCategoryItem +from grabfood.models.menu_sync_fail import MenuSyncFail +from grabfood.models.menu_sync_fail_category import MenuSyncFailCategory +from grabfood.models.menu_sync_fail_item import MenuSyncFailItem +from grabfood.models.menu_sync_fail_modifier import MenuSyncFailModifier +from grabfood.models.menu_sync_fail_modifier_group import MenuSyncFailModifierGroup +from grabfood.models.menu_sync_fail_service_hours import MenuSyncFailServiceHours +from grabfood.models.menu_sync_response import MenuSyncResponse +from grabfood.models.menu_sync_webhook_request import MenuSyncWebhookRequest +from grabfood.models.modifier_group import ModifierGroup +from grabfood.models.new_order_time_request import NewOrderTimeRequest +from grabfood.models.notify_membership_webview_request import NotifyMembershipWebviewRequest +from grabfood.models.open_period import OpenPeriod +from grabfood.models.order import Order +from grabfood.models.order_campaign import OrderCampaign +from grabfood.models.order_delivery_request import OrderDeliveryRequest +from grabfood.models.order_feature_flags import OrderFeatureFlags +from grabfood.models.order_free_item import OrderFreeItem +from grabfood.models.order_item import OrderItem +from grabfood.models.order_item_modifier import OrderItemModifier +from grabfood.models.order_price import OrderPrice +from grabfood.models.order_promo import OrderPromo +from grabfood.models.order_ready_estimation import OrderReadyEstimation +from grabfood.models.order_state_request import OrderStateRequest +from grabfood.models.out_of_stock_instruction import OutOfStockInstruction +from grabfood.models.partner_oauth_request import PartnerOauthRequest +from grabfood.models.partner_oauth_response import PartnerOauthResponse +from grabfood.models.pause_store_request import PauseStoreRequest +from grabfood.models.purchasability import Purchasability +from grabfood.models.push_integration_status_webhook_request import PushIntegrationStatusWebhookRequest +from grabfood.models.receiver import Receiver +from grabfood.models.redeem_dine_in_voucher_request import RedeemDineInVoucherRequest +from grabfood.models.redeem_dine_in_voucher_response import RedeemDineInVoucherResponse +from grabfood.models.redeem_result import RedeemResult +from grabfood.models.register_membership_native_request import RegisterMembershipNativeRequest +from grabfood.models.register_membership_native_response import RegisterMembershipNativeResponse +from grabfood.models.reward_item import RewardItem +from grabfood.models.selling_time import SellingTime +from grabfood.models.service_hour import ServiceHour +from grabfood.models.service_hours import ServiceHours +from grabfood.models.special_opening_hour import SpecialOpeningHour +from grabfood.models.special_opening_hour_metadata import SpecialOpeningHourMetadata +from grabfood.models.special_opening_hour_opening_hours import SpecialOpeningHourOpeningHours +from grabfood.models.store_hour import StoreHour +from grabfood.models.store_hour_response import StoreHourResponse +from grabfood.models.store_status_response import StoreStatusResponse +from grabfood.models.submit_order_request import SubmitOrderRequest +from grabfood.models.unbind_membership_native_request import UnbindMembershipNativeRequest +from grabfood.models.unlink_membership_webview_request import UnlinkMembershipWebviewRequest +from grabfood.models.update_advanced_pricing import UpdateAdvancedPricing +from grabfood.models.update_campaign_request import UpdateCampaignRequest +from grabfood.models.update_delivery_hour_request import UpdateDeliveryHourRequest +from grabfood.models.update_delivery_hour_response import UpdateDeliveryHourResponse +from grabfood.models.update_dine_in_hour_request import UpdateDineInHourRequest +from grabfood.models.update_dine_in_hour_response import UpdateDineInHourResponse +from grabfood.models.update_menu_item import UpdateMenuItem +from grabfood.models.update_menu_modifier import UpdateMenuModifier +from grabfood.models.update_menu_notif_request import UpdateMenuNotifRequest +from grabfood.models.update_menu_request import UpdateMenuRequest +from grabfood.models.update_purchasability import UpdatePurchasability +from grabfood.models.update_special_hour_request import UpdateSpecialHourRequest +from grabfood.models.update_special_hour_response import UpdateSpecialHourResponse +from grabfood.models.voucher import Voucher +from grabfood.models.voucher_description_info import VoucherDescriptionInfo +from grabfood.models.working_hour import WorkingHour +from grabfood.models.working_hour_day import WorkingHourDay + +# import config into sdk package +from grabfood.configs import STG_ENV +from grabfood.configs import PRD_ENV +from grabfood.configs import STG_AUTH_ENV +from grabfood.configs import PRD_AUTH_ENV diff --git a/grabfood/api/__init__.py b/grabfood/api/__init__.py new file mode 100644 index 0000000..17084ba --- /dev/null +++ b/grabfood/api/__init__.py @@ -0,0 +1,30 @@ +# flake8: noqa + +# import apis into api package +from grabfood.api.accept_reject_order_api import AcceptRejectOrderApi +from grabfood.api.cancel_order_api import CancelOrderApi +from grabfood.api.check_order_cancelable_api import CheckOrderCancelableApi +from grabfood.api.create_campaign_api import CreateCampaignApi +from grabfood.api.create_self_serve_journey_api import CreateSelfServeJourneyApi +from grabfood.api.delete_campaign_api import DeleteCampaignApi +from grabfood.api.edit_order_api import EditOrderApi +from grabfood.api.get_dinein_voucher_api import GetDineinVoucherApi +from grabfood.api.get_oauth_grab_api import GetOauthGrabApi +from grabfood.api.get_store_hour_api import GetStoreHourApi +from grabfood.api.get_store_status_api import GetStoreStatusApi +from grabfood.api.list_campaign_api import ListCampaignApi +from grabfood.api.list_orders_api import ListOrdersApi +from grabfood.api.mark_order_ready_api import MarkOrderReadyApi +from grabfood.api.notify_membership_webview_api import NotifyMembershipWebviewApi +from grabfood.api.pause_store_api import PauseStoreApi +from grabfood.api.redeem_dinein_voucher_api import RedeemDineinVoucherApi +from grabfood.api.trace_menu_sync_api import TraceMenuSyncApi +from grabfood.api.update_campaign_api import UpdateCampaignApi +from grabfood.api.update_delivery_state_api import UpdateDeliveryStateApi +from grabfood.api.update_menu_notification_api import UpdateMenuNotificationApi +from grabfood.api.update_menu_record_api import UpdateMenuRecordApi +from grabfood.api.update_order_ready_time_api import UpdateOrderReadyTimeApi +from grabfood.api.update_store_delivery_hour_api import UpdateStoreDeliveryHourApi +from grabfood.api.update_store_dine_in_hour_api import UpdateStoreDineInHourApi +from grabfood.api.update_store_special_hour_api import UpdateStoreSpecialHourApi + diff --git a/grabfood/api/accept_reject_order_api.py b/grabfood/api/accept_reject_order_api.py new file mode 100644 index 0000000..204a0cf --- /dev/null +++ b/grabfood/api/accept_reject_order_api.py @@ -0,0 +1,331 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.accept_order_request import AcceptOrderRequest + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class AcceptRejectOrderApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def accept_reject_order( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + accept_order_request: AcceptOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Manually accept/reject orders + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param accept_order_request: (required) + :type accept_order_request: AcceptOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._accept_reject_order_serialize( + authorization=authorization, + content_type=content_type, + accept_order_request=accept_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def accept_reject_order_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + accept_order_request: AcceptOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Manually accept/reject orders + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param accept_order_request: (required) + :type accept_order_request: AcceptOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._accept_reject_order_serialize( + authorization=authorization, + content_type=content_type, + accept_order_request=accept_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def accept_reject_order_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + accept_order_request: AcceptOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Manually accept/reject orders + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param accept_order_request: (required) + :type accept_order_request: AcceptOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._accept_reject_order_serialize( + authorization=authorization, + content_type=content_type, + accept_order_request=accept_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _accept_reject_order_serialize( + self, + authorization, + content_type, + accept_order_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + if content_type is not None: + _header_params['Content-Type'] = content_type + # process the form parameters + # process the body parameter + if accept_order_request is not None: + _body_params = accept_order_request + + + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/partner/v1/order/prepare', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/cancel_order_api.py b/grabfood/api/cancel_order_api.py new file mode 100644 index 0000000..f867d43 --- /dev/null +++ b/grabfood/api/cancel_order_api.py @@ -0,0 +1,354 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.cancel_order_request import CancelOrderRequest +from grabfood.models.cancel_order_response import CancelOrderResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class CancelOrderApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def cancel_order( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + cancel_order_request: CancelOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CancelOrderResponse: + """Cancel an order + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param cancel_order_request: (required) + :type cancel_order_request: CancelOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._cancel_order_serialize( + content_type=content_type, + authorization=authorization, + cancel_order_request=cancel_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CancelOrderResponse", + '400': "Error", + '403': "Error", + '404': "Error", + '409': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def cancel_order_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + cancel_order_request: CancelOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CancelOrderResponse]: + """Cancel an order + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param cancel_order_request: (required) + :type cancel_order_request: CancelOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._cancel_order_serialize( + content_type=content_type, + authorization=authorization, + cancel_order_request=cancel_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CancelOrderResponse", + '400': "Error", + '403': "Error", + '404': "Error", + '409': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def cancel_order_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + cancel_order_request: CancelOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Cancel an order + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param cancel_order_request: (required) + :type cancel_order_request: CancelOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._cancel_order_serialize( + content_type=content_type, + authorization=authorization, + cancel_order_request=cancel_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CancelOrderResponse", + '400': "Error", + '403': "Error", + '404': "Error", + '409': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _cancel_order_serialize( + self, + content_type, + authorization, + cancel_order_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if cancel_order_request is not None: + _body_params = cancel_order_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/partner/v1/order/cancel', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/check_order_cancelable_api.py b/grabfood/api/check_order_cancelable_api.py new file mode 100644 index 0000000..945153b --- /dev/null +++ b/grabfood/api/check_order_cancelable_api.py @@ -0,0 +1,329 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.check_order_cancelable_response import CheckOrderCancelableResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class CheckOrderCancelableApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def check_order_cancelable( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + order_id: StrictStr, + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CheckOrderCancelableResponse: + """Check order cancelable + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param order_id: (required) + :type order_id: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._check_order_cancelable_serialize( + authorization=authorization, + order_id=order_id, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CheckOrderCancelableResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def check_order_cancelable_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + order_id: StrictStr, + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CheckOrderCancelableResponse]: + """Check order cancelable + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param order_id: (required) + :type order_id: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._check_order_cancelable_serialize( + authorization=authorization, + order_id=order_id, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CheckOrderCancelableResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def check_order_cancelable_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + order_id: StrictStr, + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Check order cancelable + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param order_id: (required) + :type order_id: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._check_order_cancelable_serialize( + authorization=authorization, + order_id=order_id, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CheckOrderCancelableResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _check_order_cancelable_serialize( + self, + authorization, + order_id, + merchant_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if order_id is not None: + + _query_params.append(('orderID', order_id)) + + if merchant_id is not None: + + _query_params.append(('merchantID', merchant_id)) + + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/partner/v1/order/cancelable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/create_campaign_api.py b/grabfood/api/create_campaign_api.py new file mode 100644 index 0000000..2396032 --- /dev/null +++ b/grabfood/api/create_campaign_api.py @@ -0,0 +1,342 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.create_campaign_request import CreateCampaignRequest +from grabfood.models.create_campaign_response import CreateCampaignResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class CreateCampaignApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_campaign( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + create_campaign_request: CreateCampaignRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateCampaignResponse: + """Create campaign + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param create_campaign_request: (required) + :type create_campaign_request: CreateCampaignRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_campaign_serialize( + content_type=content_type, + authorization=authorization, + create_campaign_request=create_campaign_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateCampaignResponse", + '400': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_campaign_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + create_campaign_request: CreateCampaignRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateCampaignResponse]: + """Create campaign + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param create_campaign_request: (required) + :type create_campaign_request: CreateCampaignRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_campaign_serialize( + content_type=content_type, + authorization=authorization, + create_campaign_request=create_campaign_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateCampaignResponse", + '400': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_campaign_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + create_campaign_request: CreateCampaignRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create campaign + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param create_campaign_request: (required) + :type create_campaign_request: CreateCampaignRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_campaign_serialize( + content_type=content_type, + authorization=authorization, + create_campaign_request=create_campaign_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateCampaignResponse", + '400': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_campaign_serialize( + self, + content_type, + authorization, + create_campaign_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if create_campaign_request is not None: + _body_params = create_campaign_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/partner/v1/campaigns', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/create_self_serve_journey_api.py b/grabfood/api/create_self_serve_journey_api.py new file mode 100644 index 0000000..1968e85 --- /dev/null +++ b/grabfood/api/create_self_serve_journey_api.py @@ -0,0 +1,339 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.create_self_serve_journey_request import CreateSelfServeJourneyRequest +from grabfood.models.create_self_serve_journey_response import CreateSelfServeJourneyResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class CreateSelfServeJourneyApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_self_serve_journey( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + create_self_serve_journey_request: CreateSelfServeJourneyRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateSelfServeJourneyResponse: + """Create self serve journey + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param create_self_serve_journey_request: (required) + :type create_self_serve_journey_request: CreateSelfServeJourneyRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_self_serve_journey_serialize( + content_type=content_type, + authorization=authorization, + create_self_serve_journey_request=create_self_serve_journey_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateSelfServeJourneyResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_self_serve_journey_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + create_self_serve_journey_request: CreateSelfServeJourneyRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateSelfServeJourneyResponse]: + """Create self serve journey + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param create_self_serve_journey_request: (required) + :type create_self_serve_journey_request: CreateSelfServeJourneyRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_self_serve_journey_serialize( + content_type=content_type, + authorization=authorization, + create_self_serve_journey_request=create_self_serve_journey_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateSelfServeJourneyResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_self_serve_journey_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + create_self_serve_journey_request: CreateSelfServeJourneyRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create self serve journey + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param create_self_serve_journey_request: (required) + :type create_self_serve_journey_request: CreateSelfServeJourneyRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_self_serve_journey_serialize( + content_type=content_type, + authorization=authorization, + create_self_serve_journey_request=create_self_serve_journey_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateSelfServeJourneyResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_self_serve_journey_serialize( + self, + content_type, + authorization, + create_self_serve_journey_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if create_self_serve_journey_request is not None: + _body_params = create_self_serve_journey_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/partner/v1/self-serve/activation', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/delete_campaign_api.py b/grabfood/api/delete_campaign_api.py new file mode 100644 index 0000000..39259c7 --- /dev/null +++ b/grabfood/api/delete_campaign_api.py @@ -0,0 +1,302 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class DeleteCampaignApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def delete_campaign( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + campaign_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete campaigns + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param campaign_id: (required) + :type campaign_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_campaign_serialize( + authorization=authorization, + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_campaign_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + campaign_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete campaigns + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param campaign_id: (required) + :type campaign_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_campaign_serialize( + authorization=authorization, + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_campaign_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + campaign_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete campaigns + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param campaign_id: (required) + :type campaign_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_campaign_serialize( + authorization=authorization, + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_campaign_serialize( + self, + authorization, + campaign_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaign_id'] = campaign_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/partner/v1/campaigns/{campaign_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/edit_order_api.py b/grabfood/api/edit_order_api.py new file mode 100644 index 0000000..0b92a9f --- /dev/null +++ b/grabfood/api/edit_order_api.py @@ -0,0 +1,356 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.edit_order_request import EditOrderRequest + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class EditOrderApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def edit_order( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + order_id: StrictStr, + edit_order_request: EditOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Edit Order + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param order_id: (required) + :type order_id: str + :param edit_order_request: (required) + :type edit_order_request: EditOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_order_serialize( + content_type=content_type, + authorization=authorization, + order_id=order_id, + edit_order_request=edit_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '4XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def edit_order_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + order_id: StrictStr, + edit_order_request: EditOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Edit Order + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param order_id: (required) + :type order_id: str + :param edit_order_request: (required) + :type edit_order_request: EditOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_order_serialize( + content_type=content_type, + authorization=authorization, + order_id=order_id, + edit_order_request=edit_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '4XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def edit_order_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + order_id: StrictStr, + edit_order_request: EditOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Edit Order + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param order_id: (required) + :type order_id: str + :param edit_order_request: (required) + :type edit_order_request: EditOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_order_serialize( + content_type=content_type, + authorization=authorization, + order_id=order_id, + edit_order_request=edit_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '4XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _edit_order_serialize( + self, + content_type, + authorization, + order_id, + edit_order_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if order_id is not None: + _path_params['orderID'] = order_id + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if edit_order_request is not None: + _body_params = edit_order_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/partner/v1/orders/{orderID}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/get_dinein_voucher_api.py b/grabfood/api/get_dinein_voucher_api.py new file mode 100644 index 0000000..8f6adef --- /dev/null +++ b/grabfood/api/get_dinein_voucher_api.py @@ -0,0 +1,353 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from grabfood.models.get_dine_in_voucher_response import GetDineInVoucherResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class GetDineinVoucherApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_dinein_voucher( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: StrictStr, + voucher_code: Annotated[Optional[Annotated[str, Field(strict=True, max_length=11)]], Field(description="A short code for the dine-in voucher purchased by the user. Required if `certificateID` is not specified.")] = None, + certificate_id: Annotated[Optional[StrictStr], Field(description="This certificateID is decoded from scanning the QR code, and 1:1 mapping with voucherCode. Required if `voucherCode` is not specified.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetDineInVoucherResponse: + """Get Dine In Voucher + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: (required) + :type merchant_id: str + :param voucher_code: A short code for the dine-in voucher purchased by the user. Required if `certificateID` is not specified. + :type voucher_code: str + :param certificate_id: This certificateID is decoded from scanning the QR code, and 1:1 mapping with voucherCode. Required if `voucherCode` is not specified. + :type certificate_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_dinein_voucher_serialize( + authorization=authorization, + merchant_id=merchant_id, + voucher_code=voucher_code, + certificate_id=certificate_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetDineInVoucherResponse", + '400': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_dinein_voucher_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: StrictStr, + voucher_code: Annotated[Optional[Annotated[str, Field(strict=True, max_length=11)]], Field(description="A short code for the dine-in voucher purchased by the user. Required if `certificateID` is not specified.")] = None, + certificate_id: Annotated[Optional[StrictStr], Field(description="This certificateID is decoded from scanning the QR code, and 1:1 mapping with voucherCode. Required if `voucherCode` is not specified.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetDineInVoucherResponse]: + """Get Dine In Voucher + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: (required) + :type merchant_id: str + :param voucher_code: A short code for the dine-in voucher purchased by the user. Required if `certificateID` is not specified. + :type voucher_code: str + :param certificate_id: This certificateID is decoded from scanning the QR code, and 1:1 mapping with voucherCode. Required if `voucherCode` is not specified. + :type certificate_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_dinein_voucher_serialize( + authorization=authorization, + merchant_id=merchant_id, + voucher_code=voucher_code, + certificate_id=certificate_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetDineInVoucherResponse", + '400': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_dinein_voucher_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: StrictStr, + voucher_code: Annotated[Optional[Annotated[str, Field(strict=True, max_length=11)]], Field(description="A short code for the dine-in voucher purchased by the user. Required if `certificateID` is not specified.")] = None, + certificate_id: Annotated[Optional[StrictStr], Field(description="This certificateID is decoded from scanning the QR code, and 1:1 mapping with voucherCode. Required if `voucherCode` is not specified.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Dine In Voucher + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: (required) + :type merchant_id: str + :param voucher_code: A short code for the dine-in voucher purchased by the user. Required if `certificateID` is not specified. + :type voucher_code: str + :param certificate_id: This certificateID is decoded from scanning the QR code, and 1:1 mapping with voucherCode. Required if `voucherCode` is not specified. + :type certificate_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_dinein_voucher_serialize( + authorization=authorization, + merchant_id=merchant_id, + voucher_code=voucher_code, + certificate_id=certificate_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetDineInVoucherResponse", + '400': "Error", + '404': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_dinein_voucher_serialize( + self, + authorization, + merchant_id, + voucher_code, + certificate_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if voucher_code is not None: + + _query_params.append(('voucherCode', voucher_code)) + + if certificate_id is not None: + + _query_params.append(('certificateID', certificate_id)) + + if merchant_id is not None: + + _query_params.append(('merchantID', merchant_id)) + + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/partner/v1/dinein/voucher', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/get_oauth_grab_api.py b/grabfood/api/get_oauth_grab_api.py new file mode 100644 index 0000000..5d2685d --- /dev/null +++ b/grabfood/api/get_oauth_grab_api.py @@ -0,0 +1,328 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.grab_oauth_request import GrabOauthRequest +from grabfood.models.grab_oauth_response import GrabOauthResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class GetOauthGrabApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_oauth_grab( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + grab_oauth_request: GrabOauthRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=2)] = 0, + ) -> GrabOauthResponse: + """Get Oauth access token + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param grab_oauth_request: (required) + :type grab_oauth_request: GrabOauthRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_oauth_grab_serialize( + content_type=content_type, + grab_oauth_request=grab_oauth_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GrabOauthResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_oauth_grab_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + grab_oauth_request: GrabOauthRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=2)] = 0, + ) -> ApiResponse[GrabOauthResponse]: + """Get Oauth access token + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param grab_oauth_request: (required) + :type grab_oauth_request: GrabOauthRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_oauth_grab_serialize( + content_type=content_type, + grab_oauth_request=grab_oauth_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GrabOauthResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_oauth_grab_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + grab_oauth_request: GrabOauthRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=2)] = 0, + ) -> RESTResponseType: + """Get Oauth access token + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param grab_oauth_request: (required) + :type grab_oauth_request: GrabOauthRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_oauth_grab_serialize( + content_type=content_type, + grab_oauth_request=grab_oauth_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GrabOauthResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_oauth_grab_serialize( + self, + content_type, + grab_oauth_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.grab.com', + 'https://api.grab.com' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + # process the form parameters + # process the body parameter + if grab_oauth_request is not None: + _body_params = grab_oauth_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/grabid/v1/oauth2/token', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/get_store_hour_api.py b/grabfood/api/get_store_hour_api.py new file mode 100644 index 0000000..3aa3759 --- /dev/null +++ b/grabfood/api/get_store_hour_api.py @@ -0,0 +1,316 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.store_hour_response import StoreHourResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class GetStoreHourApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_store_hour( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> StoreHourResponse: + """Get Store Hours + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_store_hour_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StoreHourResponse", + '401': None, + '5XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_store_hour_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[StoreHourResponse]: + """Get Store Hours + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_store_hour_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StoreHourResponse", + '401': None, + '5XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_store_hour_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Store Hours + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_store_hour_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StoreHourResponse", + '401': None, + '5XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_store_hour_serialize( + self, + authorization, + merchant_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if merchant_id is not None: + _path_params['merchantID'] = merchant_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/partner/v2/merchants/{merchantID}/store/hours', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/get_store_status_api.py b/grabfood/api/get_store_status_api.py new file mode 100644 index 0000000..67857f4 --- /dev/null +++ b/grabfood/api/get_store_status_api.py @@ -0,0 +1,316 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.store_status_response import StoreStatusResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class GetStoreStatusApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_store_status( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> StoreStatusResponse: + """Get Store Status + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_store_status_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StoreStatusResponse", + '401': None, + '5XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_store_status_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[StoreStatusResponse]: + """Get Store Status + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_store_status_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StoreStatusResponse", + '401': None, + '5XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_store_status_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Store Status + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_store_status_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StoreStatusResponse", + '401': None, + '5XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_store_status_serialize( + self, + authorization, + merchant_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if merchant_id is not None: + _path_params['merchantID'] = merchant_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/partner/v1/merchants/{merchantID}/store/status', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/list_campaign_api.py b/grabfood/api/list_campaign_api.py new file mode 100644 index 0000000..db39c81 --- /dev/null +++ b/grabfood/api/list_campaign_api.py @@ -0,0 +1,312 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.list_campaign_response import ListCampaignResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class ListCampaignApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def list_campaign( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListCampaignResponse: + """List campaigns + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_campaign_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListCampaignResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_campaign_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListCampaignResponse]: + """List campaigns + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_campaign_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListCampaignResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_campaign_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List campaigns + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_campaign_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListCampaignResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_campaign_serialize( + self, + authorization, + merchant_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if merchant_id is not None: + + _query_params.append(('merchantID', merchant_id)) + + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/partner/v1/campaigns', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/list_orders_api.py b/grabfood/api/list_orders_api.py new file mode 100644 index 0000000..06d65e7 --- /dev/null +++ b/grabfood/api/list_orders_api.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr +from typing_extensions import Annotated +from grabfood.models.list_orders_response import ListOrdersResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class ListOrdersApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def list_orders( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + var_date: StrictStr, + page: Annotated[StrictInt, Field(description="Specify the page number for the report.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListOrdersResponse: + """List orders + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param var_date: (required) + :type var_date: str + :param page: Specify the page number for the report. (required) + :type page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_orders_serialize( + authorization=authorization, + merchant_id=merchant_id, + var_date=var_date, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2xx': "ListOrdersResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_orders_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + var_date: StrictStr, + page: Annotated[StrictInt, Field(description="Specify the page number for the report.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListOrdersResponse]: + """List orders + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param var_date: (required) + :type var_date: str + :param page: Specify the page number for the report. (required) + :type page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_orders_serialize( + authorization=authorization, + merchant_id=merchant_id, + var_date=var_date, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2xx': "ListOrdersResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_orders_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + var_date: StrictStr, + page: Annotated[StrictInt, Field(description="Specify the page number for the report.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List orders + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param var_date: (required) + :type var_date: str + :param page: Specify the page number for the report. (required) + :type page: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_orders_serialize( + authorization=authorization, + merchant_id=merchant_id, + var_date=var_date, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2xx': "ListOrdersResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_orders_serialize( + self, + authorization, + merchant_id, + var_date, + page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if merchant_id is not None: + + _query_params.append(('merchantID', merchant_id)) + + if var_date is not None: + + _query_params.append(('date', var_date)) + + if page is not None: + + _query_params.append(('page', page)) + + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/partner/v1/orders', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/mark_order_ready_api.py b/grabfood/api/mark_order_ready_api.py new file mode 100644 index 0000000..81c9ff2 --- /dev/null +++ b/grabfood/api/mark_order_ready_api.py @@ -0,0 +1,341 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.mark_order_request import MarkOrderRequest + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class MarkOrderReadyApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def mark_order_ready( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + mark_order_request: MarkOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Mark order as ready + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param mark_order_request: (required) + :type mark_order_request: MarkOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_order_ready_serialize( + content_type=content_type, + authorization=authorization, + mark_order_request=mark_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def mark_order_ready_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + mark_order_request: MarkOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Mark order as ready + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param mark_order_request: (required) + :type mark_order_request: MarkOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_order_ready_serialize( + content_type=content_type, + authorization=authorization, + mark_order_request=mark_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def mark_order_ready_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + mark_order_request: MarkOrderRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Mark order as ready + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param mark_order_request: (required) + :type mark_order_request: MarkOrderRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_order_ready_serialize( + content_type=content_type, + authorization=authorization, + mark_order_request=mark_order_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _mark_order_ready_serialize( + self, + content_type, + authorization, + mark_order_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if mark_order_request is not None: + _body_params = mark_order_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/partner/v1/orders/mark', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/notify_membership_webview_api.py b/grabfood/api/notify_membership_webview_api.py new file mode 100644 index 0000000..38256f8 --- /dev/null +++ b/grabfood/api/notify_membership_webview_api.py @@ -0,0 +1,334 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.notify_membership_webview_request import NotifyMembershipWebviewRequest + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class NotifyMembershipWebviewApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def notify_membership_webview( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + notify_membership_webview_request: NotifyMembershipWebviewRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Notify Membership + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param notify_membership_webview_request: (required) + :type notify_membership_webview_request: NotifyMembershipWebviewRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._notify_membership_webview_serialize( + authorization=authorization, + content_type=content_type, + notify_membership_webview_request=notify_membership_webview_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '4xx': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def notify_membership_webview_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + notify_membership_webview_request: NotifyMembershipWebviewRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Notify Membership + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param notify_membership_webview_request: (required) + :type notify_membership_webview_request: NotifyMembershipWebviewRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._notify_membership_webview_serialize( + authorization=authorization, + content_type=content_type, + notify_membership_webview_request=notify_membership_webview_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '4xx': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def notify_membership_webview_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + notify_membership_webview_request: NotifyMembershipWebviewRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Notify Membership + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param notify_membership_webview_request: (required) + :type notify_membership_webview_request: NotifyMembershipWebviewRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._notify_membership_webview_serialize( + authorization=authorization, + content_type=content_type, + notify_membership_webview_request=notify_membership_webview_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '4xx': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _notify_membership_webview_serialize( + self, + authorization, + content_type, + notify_membership_webview_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + if content_type is not None: + _header_params['Content-Type'] = content_type + # process the form parameters + # process the body parameter + if notify_membership_webview_request is not None: + _body_params = notify_membership_webview_request + + + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/partner/v1/membership/notify', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/pause_store_api.py b/grabfood/api/pause_store_api.py new file mode 100644 index 0000000..2d1230f --- /dev/null +++ b/grabfood/api/pause_store_api.py @@ -0,0 +1,331 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.pause_store_request import PauseStoreRequest + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class PauseStoreApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def pause_store( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + pause_store_request: PauseStoreRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Pause store + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param pause_store_request: (required) + :type pause_store_request: PauseStoreRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pause_store_serialize( + content_type=content_type, + authorization=authorization, + pause_store_request=pause_store_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def pause_store_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + pause_store_request: PauseStoreRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Pause store + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param pause_store_request: (required) + :type pause_store_request: PauseStoreRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pause_store_serialize( + content_type=content_type, + authorization=authorization, + pause_store_request=pause_store_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def pause_store_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + pause_store_request: PauseStoreRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pause store + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param pause_store_request: (required) + :type pause_store_request: PauseStoreRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pause_store_serialize( + content_type=content_type, + authorization=authorization, + pause_store_request=pause_store_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _pause_store_serialize( + self, + content_type, + authorization, + pause_store_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if pause_store_request is not None: + _body_params = pause_store_request + + + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/partner/v1/merchant/pause', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/redeem_dinein_voucher_api.py b/grabfood/api/redeem_dinein_voucher_api.py new file mode 100644 index 0000000..31cb6cd --- /dev/null +++ b/grabfood/api/redeem_dinein_voucher_api.py @@ -0,0 +1,348 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.redeem_dine_in_voucher_request import RedeemDineInVoucherRequest +from grabfood.models.redeem_dine_in_voucher_response import RedeemDineInVoucherResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class RedeemDineinVoucherApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def redeem_dinein_voucher( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + redeem_dine_in_voucher_request: RedeemDineInVoucherRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RedeemDineInVoucherResponse: + """Redeem Dine In Voucher + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param redeem_dine_in_voucher_request: (required) + :type redeem_dine_in_voucher_request: RedeemDineInVoucherRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_dinein_voucher_serialize( + authorization=authorization, + content_type=content_type, + redeem_dine_in_voucher_request=redeem_dine_in_voucher_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RedeemDineInVoucherResponse", + '400': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def redeem_dinein_voucher_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + redeem_dine_in_voucher_request: RedeemDineInVoucherRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RedeemDineInVoucherResponse]: + """Redeem Dine In Voucher + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param redeem_dine_in_voucher_request: (required) + :type redeem_dine_in_voucher_request: RedeemDineInVoucherRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_dinein_voucher_serialize( + authorization=authorization, + content_type=content_type, + redeem_dine_in_voucher_request=redeem_dine_in_voucher_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RedeemDineInVoucherResponse", + '400': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def redeem_dinein_voucher_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + redeem_dine_in_voucher_request: RedeemDineInVoucherRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Redeem Dine In Voucher + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param redeem_dine_in_voucher_request: (required) + :type redeem_dine_in_voucher_request: RedeemDineInVoucherRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_dinein_voucher_serialize( + authorization=authorization, + content_type=content_type, + redeem_dine_in_voucher_request=redeem_dine_in_voucher_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RedeemDineInVoucherResponse", + '400': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _redeem_dinein_voucher_serialize( + self, + authorization, + content_type, + redeem_dine_in_voucher_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + if content_type is not None: + _header_params['Content-Type'] = content_type + # process the form parameters + # process the body parameter + if redeem_dine_in_voucher_request is not None: + _body_params = redeem_dine_in_voucher_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/partner/v1/dinein/voucher/redeem', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/trace_menu_sync_api.py b/grabfood/api/trace_menu_sync_api.py new file mode 100644 index 0000000..1e84a48 --- /dev/null +++ b/grabfood/api/trace_menu_sync_api.py @@ -0,0 +1,315 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.menu_sync_response import MenuSyncResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class TraceMenuSyncApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def trace_menu_sync( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MenuSyncResponse: + """Trace menu sync + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._trace_menu_sync_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MenuSyncResponse", + '4xx': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def trace_menu_sync_with_http_info( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MenuSyncResponse]: + """Trace menu sync + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._trace_menu_sync_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MenuSyncResponse", + '4xx': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def trace_menu_sync_without_preload_content( + self, + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trace menu sync + + + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._trace_menu_sync_serialize( + authorization=authorization, + merchant_id=merchant_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MenuSyncResponse", + '4xx': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _trace_menu_sync_serialize( + self, + authorization, + merchant_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if merchant_id is not None: + + _query_params.append(('merchantID', merchant_id)) + + # process the header parameters + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/partner/v1/merchant/menu/trace', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/update_campaign_api.py b/grabfood/api/update_campaign_api.py new file mode 100644 index 0000000..5eed895 --- /dev/null +++ b/grabfood/api/update_campaign_api.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.update_campaign_request import UpdateCampaignRequest + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class UpdateCampaignApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def update_campaign( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + campaign_id: StrictStr, + update_campaign_request: UpdateCampaignRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update campaign + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param campaign_id: (required) + :type campaign_id: str + :param update_campaign_request: (required) + :type update_campaign_request: UpdateCampaignRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_campaign_serialize( + content_type=content_type, + authorization=authorization, + campaign_id=campaign_id, + update_campaign_request=update_campaign_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_campaign_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + campaign_id: StrictStr, + update_campaign_request: UpdateCampaignRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update campaign + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param campaign_id: (required) + :type campaign_id: str + :param update_campaign_request: (required) + :type update_campaign_request: UpdateCampaignRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_campaign_serialize( + content_type=content_type, + authorization=authorization, + campaign_id=campaign_id, + update_campaign_request=update_campaign_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_campaign_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + campaign_id: StrictStr, + update_campaign_request: UpdateCampaignRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update campaign + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param campaign_id: (required) + :type campaign_id: str + :param update_campaign_request: (required) + :type update_campaign_request: UpdateCampaignRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_campaign_serialize( + content_type=content_type, + authorization=authorization, + campaign_id=campaign_id, + update_campaign_request=update_campaign_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_campaign_serialize( + self, + content_type, + authorization, + campaign_id, + update_campaign_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaign_id'] = campaign_id + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if update_campaign_request is not None: + _body_params = update_campaign_request + + + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/partner/v1/campaigns/{campaign_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/update_delivery_state_api.py b/grabfood/api/update_delivery_state_api.py new file mode 100644 index 0000000..b486b33 --- /dev/null +++ b/grabfood/api/update_delivery_state_api.py @@ -0,0 +1,331 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.order_delivery_request import OrderDeliveryRequest + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class UpdateDeliveryStateApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def update_delivery_state( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + order_delivery_request: OrderDeliveryRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update delivery state + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param order_delivery_request: (required) + :type order_delivery_request: OrderDeliveryRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_delivery_state_serialize( + content_type=content_type, + authorization=authorization, + order_delivery_request=order_delivery_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_delivery_state_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + order_delivery_request: OrderDeliveryRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update delivery state + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param order_delivery_request: (required) + :type order_delivery_request: OrderDeliveryRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_delivery_state_serialize( + content_type=content_type, + authorization=authorization, + order_delivery_request=order_delivery_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_delivery_state_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + order_delivery_request: OrderDeliveryRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update delivery state + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param order_delivery_request: (required) + :type order_delivery_request: OrderDeliveryRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_delivery_state_serialize( + content_type=content_type, + authorization=authorization, + order_delivery_request=order_delivery_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_delivery_state_serialize( + self, + content_type, + authorization, + order_delivery_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if order_delivery_request is not None: + _body_params = order_delivery_request + + + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/partner/v1/order/delivery', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/update_menu_notification_api.py b/grabfood/api/update_menu_notification_api.py new file mode 100644 index 0000000..5b6cce3 --- /dev/null +++ b/grabfood/api/update_menu_notification_api.py @@ -0,0 +1,341 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.update_menu_notif_request import UpdateMenuNotifRequest + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class UpdateMenuNotificationApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def update_menu_notification( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + update_menu_notif_request: UpdateMenuNotifRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Notify Grab of updated menu + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param update_menu_notif_request: (required) + :type update_menu_notif_request: UpdateMenuNotifRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_menu_notification_serialize( + content_type=content_type, + authorization=authorization, + update_menu_notif_request=update_menu_notif_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '4XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_menu_notification_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + update_menu_notif_request: UpdateMenuNotifRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Notify Grab of updated menu + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param update_menu_notif_request: (required) + :type update_menu_notif_request: UpdateMenuNotifRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_menu_notification_serialize( + content_type=content_type, + authorization=authorization, + update_menu_notif_request=update_menu_notif_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '4XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_menu_notification_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + update_menu_notif_request: UpdateMenuNotifRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Notify Grab of updated menu + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param update_menu_notif_request: (required) + :type update_menu_notif_request: UpdateMenuNotifRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_menu_notification_serialize( + content_type=content_type, + authorization=authorization, + update_menu_notif_request=update_menu_notif_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '4XX': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_menu_notification_serialize( + self, + content_type, + authorization, + update_menu_notif_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if update_menu_notif_request is not None: + _body_params = update_menu_notif_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/partner/v1/merchant/menu/notification', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/update_menu_record_api.py b/grabfood/api/update_menu_record_api.py new file mode 100644 index 0000000..accc6d7 --- /dev/null +++ b/grabfood/api/update_menu_record_api.py @@ -0,0 +1,640 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.batch_update_menu_item import BatchUpdateMenuItem +from grabfood.models.batch_update_menu_response import BatchUpdateMenuResponse +from grabfood.models.update_menu_request import UpdateMenuRequest + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class UpdateMenuRecordApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def batch_update_menu( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + batch_update_menu_item: BatchUpdateMenuItem, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BatchUpdateMenuResponse: + """Batch Update Menu + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param batch_update_menu_item: (required) + :type batch_update_menu_item: BatchUpdateMenuItem + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._batch_update_menu_serialize( + content_type=content_type, + authorization=authorization, + batch_update_menu_item=batch_update_menu_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchUpdateMenuResponse", + '400': None, + '409': None, + '429': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def batch_update_menu_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + batch_update_menu_item: BatchUpdateMenuItem, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BatchUpdateMenuResponse]: + """Batch Update Menu + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param batch_update_menu_item: (required) + :type batch_update_menu_item: BatchUpdateMenuItem + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._batch_update_menu_serialize( + content_type=content_type, + authorization=authorization, + batch_update_menu_item=batch_update_menu_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchUpdateMenuResponse", + '400': None, + '409': None, + '429': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def batch_update_menu_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + batch_update_menu_item: BatchUpdateMenuItem, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Batch Update Menu + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param batch_update_menu_item: (required) + :type batch_update_menu_item: BatchUpdateMenuItem + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._batch_update_menu_serialize( + content_type=content_type, + authorization=authorization, + batch_update_menu_item=batch_update_menu_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchUpdateMenuResponse", + '400': None, + '409': None, + '429': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _batch_update_menu_serialize( + self, + content_type, + authorization, + batch_update_menu_item, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if batch_update_menu_item is not None: + _body_params = batch_update_menu_item + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/partner/v1/batch/menu', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_menu( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + update_menu_request: UpdateMenuRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update menu record + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param update_menu_request: (required) + :type update_menu_request: UpdateMenuRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_menu_serialize( + content_type=content_type, + authorization=authorization, + update_menu_request=update_menu_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_menu_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + update_menu_request: UpdateMenuRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update menu record + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param update_menu_request: (required) + :type update_menu_request: UpdateMenuRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_menu_serialize( + content_type=content_type, + authorization=authorization, + update_menu_request=update_menu_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_menu_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + update_menu_request: UpdateMenuRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update menu record + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param update_menu_request: (required) + :type update_menu_request: UpdateMenuRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_menu_serialize( + content_type=content_type, + authorization=authorization, + update_menu_request=update_menu_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_menu_serialize( + self, + content_type, + authorization, + update_menu_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if update_menu_request is not None: + _body_params = update_menu_request + + + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/partner/v1/menu', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/update_order_ready_time_api.py b/grabfood/api/update_order_ready_time_api.py new file mode 100644 index 0000000..7dce266 --- /dev/null +++ b/grabfood/api/update_order_ready_time_api.py @@ -0,0 +1,341 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.new_order_time_request import NewOrderTimeRequest + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class UpdateOrderReadyTimeApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def update_order_ready_time( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + new_order_time_request: NewOrderTimeRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update new order ready time + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param new_order_time_request: (required) + :type new_order_time_request: NewOrderTimeRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_order_ready_time_serialize( + content_type=content_type, + authorization=authorization, + new_order_time_request=new_order_time_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_order_ready_time_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + new_order_time_request: NewOrderTimeRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update new order ready time + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param new_order_time_request: (required) + :type new_order_time_request: NewOrderTimeRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_order_ready_time_serialize( + content_type=content_type, + authorization=authorization, + new_order_time_request=new_order_time_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_order_ready_time_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + new_order_time_request: NewOrderTimeRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update new order ready time + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param new_order_time_request: (required) + :type new_order_time_request: NewOrderTimeRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_order_ready_time_serialize( + content_type=content_type, + authorization=authorization, + new_order_time_request=new_order_time_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_order_ready_time_serialize( + self, + content_type, + authorization, + new_order_time_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if new_order_time_request is not None: + _body_params = new_order_time_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/partner/v1/order/readytime', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/update_store_delivery_hour_api.py b/grabfood/api/update_store_delivery_hour_api.py new file mode 100644 index 0000000..c959862 --- /dev/null +++ b/grabfood/api/update_store_delivery_hour_api.py @@ -0,0 +1,360 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.update_delivery_hour_request import UpdateDeliveryHourRequest +from grabfood.models.update_delivery_hour_response import UpdateDeliveryHourResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class UpdateStoreDeliveryHourApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def update_store_delivery_hour( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + update_delivery_hour_request: UpdateDeliveryHourRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UpdateDeliveryHourResponse: + """Update Store Delivery Hours + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param update_delivery_hour_request: (required) + :type update_delivery_hour_request: UpdateDeliveryHourRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_store_delivery_hour_serialize( + content_type=content_type, + authorization=authorization, + merchant_id=merchant_id, + update_delivery_hour_request=update_delivery_hour_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UpdateDeliveryHourResponse", + '401': None, + '5XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_store_delivery_hour_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + update_delivery_hour_request: UpdateDeliveryHourRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UpdateDeliveryHourResponse]: + """Update Store Delivery Hours + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param update_delivery_hour_request: (required) + :type update_delivery_hour_request: UpdateDeliveryHourRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_store_delivery_hour_serialize( + content_type=content_type, + authorization=authorization, + merchant_id=merchant_id, + update_delivery_hour_request=update_delivery_hour_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UpdateDeliveryHourResponse", + '401': None, + '5XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_store_delivery_hour_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + update_delivery_hour_request: UpdateDeliveryHourRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Store Delivery Hours + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param update_delivery_hour_request: (required) + :type update_delivery_hour_request: UpdateDeliveryHourRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_store_delivery_hour_serialize( + content_type=content_type, + authorization=authorization, + merchant_id=merchant_id, + update_delivery_hour_request=update_delivery_hour_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UpdateDeliveryHourResponse", + '401': None, + '5XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_store_delivery_hour_serialize( + self, + content_type, + authorization, + merchant_id, + update_delivery_hour_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if merchant_id is not None: + _path_params['merchantID'] = merchant_id + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if update_delivery_hour_request is not None: + _body_params = update_delivery_hour_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/partner/v1/merchants/{merchantID}/store/opening-hours', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/update_store_dine_in_hour_api.py b/grabfood/api/update_store_dine_in_hour_api.py new file mode 100644 index 0000000..f4a8c55 --- /dev/null +++ b/grabfood/api/update_store_dine_in_hour_api.py @@ -0,0 +1,360 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.update_dine_in_hour_request import UpdateDineInHourRequest +from grabfood.models.update_dine_in_hour_response import UpdateDineInHourResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class UpdateStoreDineInHourApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def update_store_dine_in_hour( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + update_dine_in_hour_request: UpdateDineInHourRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UpdateDineInHourResponse: + """Update Store Dine-in Hours + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param update_dine_in_hour_request: (required) + :type update_dine_in_hour_request: UpdateDineInHourRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_store_dine_in_hour_serialize( + content_type=content_type, + authorization=authorization, + merchant_id=merchant_id, + update_dine_in_hour_request=update_dine_in_hour_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UpdateDineInHourResponse", + '401': None, + '5XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_store_dine_in_hour_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + update_dine_in_hour_request: UpdateDineInHourRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UpdateDineInHourResponse]: + """Update Store Dine-in Hours + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param update_dine_in_hour_request: (required) + :type update_dine_in_hour_request: UpdateDineInHourRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_store_dine_in_hour_serialize( + content_type=content_type, + authorization=authorization, + merchant_id=merchant_id, + update_dine_in_hour_request=update_dine_in_hour_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UpdateDineInHourResponse", + '401': None, + '5XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_store_dine_in_hour_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + update_dine_in_hour_request: UpdateDineInHourRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Store Dine-in Hours + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param update_dine_in_hour_request: (required) + :type update_dine_in_hour_request: UpdateDineInHourRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_store_dine_in_hour_serialize( + content_type=content_type, + authorization=authorization, + merchant_id=merchant_id, + update_dine_in_hour_request=update_dine_in_hour_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UpdateDineInHourResponse", + '401': None, + '5XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_store_dine_in_hour_serialize( + self, + content_type, + authorization, + merchant_id, + update_dine_in_hour_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if merchant_id is not None: + _path_params['merchantID'] = merchant_id + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if update_dine_in_hour_request is not None: + _body_params = update_dine_in_hour_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/partner/v1/merchants/{merchantID}/store/dine-in-hours', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api/update_store_special_hour_api.py b/grabfood/api/update_store_special_hour_api.py new file mode 100644 index 0000000..aeb8233 --- /dev/null +++ b/grabfood/api/update_store_special_hour_api.py @@ -0,0 +1,360 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from grabfood.models.update_special_hour_request import UpdateSpecialHourRequest +from grabfood.models.update_special_hour_response import UpdateSpecialHourResponse + +from grabfood.api_client import ApiClient, RequestSerialized +from grabfood.api_response import ApiResponse +from grabfood.rest import RESTResponseType + + +class UpdateStoreSpecialHourApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def update_store_special_hour( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + update_special_hour_request: UpdateSpecialHourRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UpdateSpecialHourResponse: + """Update Store Special Hours + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param update_special_hour_request: (required) + :type update_special_hour_request: UpdateSpecialHourRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_store_special_hour_serialize( + content_type=content_type, + authorization=authorization, + merchant_id=merchant_id, + update_special_hour_request=update_special_hour_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UpdateSpecialHourResponse", + '401': None, + '5XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_store_special_hour_with_http_info( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + update_special_hour_request: UpdateSpecialHourRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UpdateSpecialHourResponse]: + """Update Store Special Hours + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param update_special_hour_request: (required) + :type update_special_hour_request: UpdateSpecialHourRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_store_special_hour_serialize( + content_type=content_type, + authorization=authorization, + merchant_id=merchant_id, + update_special_hour_request=update_special_hour_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UpdateSpecialHourResponse", + '401': None, + '5XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_store_special_hour_without_preload_content( + self, + content_type: Annotated[StrictStr, Field(description="The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.")], + authorization: Annotated[StrictStr, Field(description="Specify the generated authorization token of the bearer type.")], + merchant_id: Annotated[StrictStr, Field(description="The merchant's ID that is in GrabFood's database.")], + update_special_hour_request: UpdateSpecialHourRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Store Special Hours + + + :param content_type: The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats. (required) + :type content_type: str + :param authorization: Specify the generated authorization token of the bearer type. (required) + :type authorization: str + :param merchant_id: The merchant's ID that is in GrabFood's database. (required) + :type merchant_id: str + :param update_special_hour_request: (required) + :type update_special_hour_request: UpdateSpecialHourRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_store_special_hour_serialize( + content_type=content_type, + authorization=authorization, + merchant_id=merchant_id, + update_special_hour_request=update_special_hour_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UpdateSpecialHourResponse", + '401': None, + '5XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_store_special_hour_serialize( + self, + content_type, + authorization, + merchant_id, + update_special_hour_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if merchant_id is not None: + _path_params['merchantID'] = merchant_id + # process the query parameters + # process the header parameters + if content_type is not None: + _header_params['Content-Type'] = content_type + if authorization is not None: + _header_params['Authorization'] = authorization + # process the form parameters + # process the body parameter + if update_special_hour_request is not None: + _body_params = update_special_hour_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/partner/v2/merchants/{merchantID}/store/special-opening-hour', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/grabfood/api_client.py b/grabfood/api_client.py new file mode 100644 index 0000000..69f4b50 --- /dev/null +++ b/grabfood/api_client.py @@ -0,0 +1,802 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +/* +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 +*/ + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal +import json +import mimetypes +import os +import re +import tempfile + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from grabfood.configuration import Configuration +from grabfood.api_response import ApiResponse, T as ApiResponseT +import grabfood.models +from grabfood import rest +from grabfood.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'GrabFood-API-SDK/1.0.1/python' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + pass + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + + def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # deserialize response data + response_text = None + return_data = None + try: + if response_type == "bytearray": + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + if isinstance(response_data.data, bytes): + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + else: + return_data = response_data.data + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + # If return_data is None, use parsed raw_data + if return_data is None and response_data.raw_data: + try: + return_data = json.loads(response_data.raw_data.decode('utf-8')) + except json.JSONDecodeError: + return_data = response_data.raw_data + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.raw_data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) + + elif isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return { + key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items() + } + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif content_type.startswith("application/json"): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif content_type.startswith("text/plain"): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(grabfood.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + elif klass == decimal.Decimal: + return decimal.Decimal(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, str(value)) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters(self, files: Dict[str, Union[str, bytes]]): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = m.group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/grabfood/api_response.py b/grabfood/api_response.py new file mode 100644 index 0000000..9bc7c11 --- /dev/null +++ b/grabfood/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/grabfood/configs/__init__.py b/grabfood/configs/__init__.py new file mode 100644 index 0000000..18a8bbe --- /dev/null +++ b/grabfood/configs/__init__.py @@ -0,0 +1,6 @@ +# import env config into configs package +from grabfood.configs.config import STG_ENV +from grabfood.configs.config import PRD_ENV +from grabfood.configs.config import STG_AUTH_ENV +from grabfood.configs.config import PRD_AUTH_ENV + diff --git a/grabfood/configs/config.py b/grabfood/configs/config.py new file mode 100644 index 0000000..e448a56 --- /dev/null +++ b/grabfood/configs/config.py @@ -0,0 +1,4 @@ +STG_ENV = "https://partner-api.grab.com/grabfood-sandbox" # Staging environment for self serve onboarding partner +PRD_ENV = "https://partner-api.grab.com/grabfood" # Production environment +STG_AUTH_ENV = "https://api.grab.com" # Staging environment authentication +PRD_AUTH_ENV = "https://api.grab.com" # Production environment authentication diff --git a/grabfood/configuration.py b/grabfood/configuration.py new file mode 100644 index 0000000..e371400 --- /dev/null +++ b/grabfood/configuration.py @@ -0,0 +1,456 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +import copy +import logging +from logging import FileHandler +import multiprocessing +import sys +from typing import Optional +import urllib3 + +import http.client as httplib + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: Number of retries for API requests. + + """ + + _default = None + + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + username=None, password=None, + access_token=None, + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ignore_operation_servers=False, + ssl_ca_cert=None, + retries=None, + *, + debug: Optional[bool] = None + ) -> None: + """Constructor + """ + self._base_path = "https://partner-api.grab.com/grabfood-sandbox" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("grabfood") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ + + self.proxy: Optional[str] = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = retries + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls): + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls): + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = Configuration() + return cls._default + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier, alias=None): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} + return auth + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 1.1.3\n"\ + "SDK Package Version: 1.0.1".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://partner-api.grab.com/grabfood-sandbox", + 'description': "Staging Environment", + }, + { + 'url': "https://partner-api.grab.com/grabfood", + 'description': "Production Environment", + } + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/grabfood/exceptions.py b/grabfood/exceptions.py new file mode 100644 index 0000000..781190d --- /dev/null +++ b/grabfood/exceptions.py @@ -0,0 +1,201 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.getheaders() + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.data or self.body: + error_message += "HTTP response body: {0}\n".format(self.data or self.body) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/grabfood/models/__init__.py b/grabfood/models/__init__.py new file mode 100644 index 0000000..18bb54c --- /dev/null +++ b/grabfood/models/__init__.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +# flake8: noqa +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +# import models into model package +from grabfood.models.accept_order_request import AcceptOrderRequest +from grabfood.models.address import Address +from grabfood.models.advanced_pricing import AdvancedPricing +from grabfood.models.batch_update_menu_item import BatchUpdateMenuItem +from grabfood.models.batch_update_menu_response import BatchUpdateMenuResponse +from grabfood.models.bind_membership_native_request import BindMembershipNativeRequest +from grabfood.models.bind_membership_native_response import BindMembershipNativeResponse +from grabfood.models.campaign import Campaign +from grabfood.models.campaign_conditions import CampaignConditions +from grabfood.models.campaign_discount import CampaignDiscount +from grabfood.models.campaign_quotas import CampaignQuotas +from grabfood.models.campaign_scope import CampaignScope +from grabfood.models.cancel_code import CancelCode +from grabfood.models.cancel_order_limit_type import CancelOrderLimitType +from grabfood.models.cancel_order_request import CancelOrderRequest +from grabfood.models.cancel_order_response import CancelOrderResponse +from grabfood.models.cancel_reason import CancelReason +from grabfood.models.check_order_cancelable_response import CheckOrderCancelableResponse +from grabfood.models.coordinates import Coordinates +from grabfood.models.create_campaign_request import CreateCampaignRequest +from grabfood.models.create_campaign_response import CreateCampaignResponse +from grabfood.models.create_self_serve_journey_request import CreateSelfServeJourneyRequest +from grabfood.models.create_self_serve_journey_request_partner import CreateSelfServeJourneyRequestPartner +from grabfood.models.create_self_serve_journey_response import CreateSelfServeJourneyResponse +from grabfood.models.currency import Currency +from grabfood.models.dine_in import DineIn +from grabfood.models.edit_order_item import EditOrderItem +from grabfood.models.edit_order_request import EditOrderRequest +from grabfood.models.error import Error +from grabfood.models.get_dine_in_voucher_response import GetDineInVoucherResponse +from grabfood.models.get_membership_native_response import GetMembershipNativeResponse +from grabfood.models.get_membership_native_response_point_info import GetMembershipNativeResponsePointInfo +from grabfood.models.get_membership_request import GetMembershipRequest +from grabfood.models.get_membership_webview_response import GetMembershipWebviewResponse +from grabfood.models.get_menu_new_response import GetMenuNewResponse +from grabfood.models.get_menu_old_response import GetMenuOldResponse +from grabfood.models.get_reward_native_request import GetRewardNativeRequest +from grabfood.models.get_reward_native_response import GetRewardNativeResponse +from grabfood.models.grab_oauth_request import GrabOauthRequest +from grabfood.models.grab_oauth_response import GrabOauthResponse +from grabfood.models.list_campaign_response import ListCampaignResponse +from grabfood.models.list_orders_response import ListOrdersResponse +from grabfood.models.mark_order_request import MarkOrderRequest +from grabfood.models.menu_category import MenuCategory +from grabfood.models.menu_entity import MenuEntity +from grabfood.models.menu_entity_error import MenuEntityError +from grabfood.models.menu_item import MenuItem +from grabfood.models.menu_modifier import MenuModifier +from grabfood.models.menu_section import MenuSection +from grabfood.models.menu_section_category import MenuSectionCategory +from grabfood.models.menu_section_category_item import MenuSectionCategoryItem +from grabfood.models.menu_sync_fail import MenuSyncFail +from grabfood.models.menu_sync_fail_category import MenuSyncFailCategory +from grabfood.models.menu_sync_fail_item import MenuSyncFailItem +from grabfood.models.menu_sync_fail_modifier import MenuSyncFailModifier +from grabfood.models.menu_sync_fail_modifier_group import MenuSyncFailModifierGroup +from grabfood.models.menu_sync_fail_service_hours import MenuSyncFailServiceHours +from grabfood.models.menu_sync_response import MenuSyncResponse +from grabfood.models.menu_sync_webhook_request import MenuSyncWebhookRequest +from grabfood.models.modifier_group import ModifierGroup +from grabfood.models.new_order_time_request import NewOrderTimeRequest +from grabfood.models.notify_membership_webview_request import NotifyMembershipWebviewRequest +from grabfood.models.open_period import OpenPeriod +from grabfood.models.order import Order +from grabfood.models.order_campaign import OrderCampaign +from grabfood.models.order_delivery_request import OrderDeliveryRequest +from grabfood.models.order_feature_flags import OrderFeatureFlags +from grabfood.models.order_free_item import OrderFreeItem +from grabfood.models.order_item import OrderItem +from grabfood.models.order_item_modifier import OrderItemModifier +from grabfood.models.order_price import OrderPrice +from grabfood.models.order_promo import OrderPromo +from grabfood.models.order_ready_estimation import OrderReadyEstimation +from grabfood.models.order_state_request import OrderStateRequest +from grabfood.models.out_of_stock_instruction import OutOfStockInstruction +from grabfood.models.partner_oauth_request import PartnerOauthRequest +from grabfood.models.partner_oauth_response import PartnerOauthResponse +from grabfood.models.pause_store_request import PauseStoreRequest +from grabfood.models.purchasability import Purchasability +from grabfood.models.push_integration_status_webhook_request import PushIntegrationStatusWebhookRequest +from grabfood.models.receiver import Receiver +from grabfood.models.redeem_dine_in_voucher_request import RedeemDineInVoucherRequest +from grabfood.models.redeem_dine_in_voucher_response import RedeemDineInVoucherResponse +from grabfood.models.redeem_result import RedeemResult +from grabfood.models.register_membership_native_request import RegisterMembershipNativeRequest +from grabfood.models.register_membership_native_response import RegisterMembershipNativeResponse +from grabfood.models.reward_item import RewardItem +from grabfood.models.selling_time import SellingTime +from grabfood.models.service_hour import ServiceHour +from grabfood.models.service_hours import ServiceHours +from grabfood.models.special_opening_hour import SpecialOpeningHour +from grabfood.models.special_opening_hour_metadata import SpecialOpeningHourMetadata +from grabfood.models.special_opening_hour_opening_hours import SpecialOpeningHourOpeningHours +from grabfood.models.store_hour import StoreHour +from grabfood.models.store_hour_response import StoreHourResponse +from grabfood.models.store_status_response import StoreStatusResponse +from grabfood.models.submit_order_request import SubmitOrderRequest +from grabfood.models.unbind_membership_native_request import UnbindMembershipNativeRequest +from grabfood.models.unlink_membership_webview_request import UnlinkMembershipWebviewRequest +from grabfood.models.update_advanced_pricing import UpdateAdvancedPricing +from grabfood.models.update_campaign_request import UpdateCampaignRequest +from grabfood.models.update_delivery_hour_request import UpdateDeliveryHourRequest +from grabfood.models.update_delivery_hour_response import UpdateDeliveryHourResponse +from grabfood.models.update_dine_in_hour_request import UpdateDineInHourRequest +from grabfood.models.update_dine_in_hour_response import UpdateDineInHourResponse +from grabfood.models.update_menu_item import UpdateMenuItem +from grabfood.models.update_menu_modifier import UpdateMenuModifier +from grabfood.models.update_menu_notif_request import UpdateMenuNotifRequest +from grabfood.models.update_menu_request import UpdateMenuRequest +from grabfood.models.update_purchasability import UpdatePurchasability +from grabfood.models.update_special_hour_request import UpdateSpecialHourRequest +from grabfood.models.update_special_hour_response import UpdateSpecialHourResponse +from grabfood.models.voucher import Voucher +from grabfood.models.voucher_description_info import VoucherDescriptionInfo +from grabfood.models.working_hour import WorkingHour +from grabfood.models.working_hour_day import WorkingHourDay diff --git a/grabfood/models/accept_order_request.py b/grabfood/models/accept_order_request.py new file mode 100644 index 0000000..155733f --- /dev/null +++ b/grabfood/models/accept_order_request.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class AcceptOrderRequest(BaseModel): + """ + The manual acceptance or rejection of an order on GrabFood. + """ # noqa: E501 + order_id: StrictStr = Field(description="The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="orderID") + to_state: StrictStr = Field(description="The order's updated state.", alias="toState") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["orderID", "toState"] + + @field_validator('to_state') + def to_state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Accepted', 'Rejected']): + raise ValueError("must be one of enum values ('Accepted', 'Rejected')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AcceptOrderRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AcceptOrderRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "orderID": obj.get("orderID"), + "toState": obj.get("toState") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/address.py b/grabfood/models/address.py new file mode 100644 index 0000000..68544c0 --- /dev/null +++ b/grabfood/models/address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.coordinates import Coordinates +from typing import Optional, Set +from typing_extensions import Self + +class Address(BaseModel): + """ + A JSON object containing the receiver’s location information. + """ # noqa: E501 + unit_number: Optional[StrictStr] = Field(default=None, description="The delivery address' unit number.", alias="unitNumber") + delivery_instruction: Optional[StrictStr] = Field(default=None, description="Instructions for the delivery.", alias="deliveryInstruction") + poi_source: Optional[StrictStr] = Field(default=None, description="POI source", alias="poiSource") + poi_id: Optional[StrictStr] = Field(default=None, description="POI ID, empty when poiSource is GRAB.", alias="poiID") + address: Optional[StrictStr] = Field(default=None, description="The delivery address containing street name, city, postal code, and country. Has value only when poiSource is `GRAB`.") + postcode: Optional[StrictStr] = Field(default=None, description="The postcode of the delivery address. Has value only when poiSource is `GRAB`.") + coordinates: Optional[Coordinates] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["unitNumber", "deliveryInstruction", "poiSource", "poiID", "address", "postcode", "coordinates"] + + @field_validator('poi_source') + def poi_source_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GRAB', 'GOOGLE']): + raise ValueError("must be one of enum values ('GRAB', 'GOOGLE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Address from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of coordinates + if self.coordinates: + _dict['coordinates'] = self.coordinates.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Address from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "unitNumber": obj.get("unitNumber"), + "deliveryInstruction": obj.get("deliveryInstruction"), + "poiSource": obj.get("poiSource"), + "poiID": obj.get("poiID"), + "address": obj.get("address"), + "postcode": obj.get("postcode"), + "coordinates": Coordinates.from_dict(obj["coordinates"]) if obj.get("coordinates") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/advanced_pricing.py b/grabfood/models/advanced_pricing.py new file mode 100644 index 0000000..7aee2a2 --- /dev/null +++ b/grabfood/models/advanced_pricing.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class AdvancedPricing(BaseModel): + """ + Price configuration (in minor unit) for different service, order type and channel combination. If a service type does not have a specified price, it will utilize the default price of the item. Refer [Service Based Menu](#section/Service-Based-Menu). + """ # noqa: E501 + delivery_on_demand_grab_app: Optional[StrictInt] = Field(default=None, description="Service type: `Delivery`, Order type: `Instant`, Channel: `Grab App` ", alias="Delivery_OnDemand_GrabApp") + delivery_scheduled_grab_app: Optional[StrictInt] = Field(default=None, description="Service type: `Delivery`, Order type: `Scheduled`, Channel: `Grab App` ", alias="Delivery_Scheduled_GrabApp") + self_pick_up_on_demand_grab_app: Optional[StrictInt] = Field(default=None, description="Service type: `Self Pick Up`, Order type: `Instant`, Channel: `Grab App` ", alias="SelfPickUp_OnDemand_GrabApp") + dine_in_on_demand_grab_app: Optional[StrictInt] = Field(default=None, description="Service type: `Dine In`, Order type: `Instant`, Channel: `Grab App` ", alias="DineIn_OnDemand_GrabApp") + delivery_on_demand_store_front: Optional[StrictInt] = Field(default=None, description="Service type: `Delivery`, Order type: `Instant`, Channel: `Store Front` ", alias="Delivery_OnDemand_StoreFront") + delivery_scheduled_store_front: Optional[StrictInt] = Field(default=None, description="Service type: `Delivery`, Order type: `Scheduled`, Channel: `Store Front` ", alias="Delivery_Scheduled_StoreFront") + self_pick_up_on_demand_store_front: Optional[StrictInt] = Field(default=None, description="Service type: `Self Pick Up`, Order type: `Instant`, Channel: `Store Front` ", alias="SelfPickUp_OnDemand_StoreFront") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["Delivery_OnDemand_GrabApp", "Delivery_Scheduled_GrabApp", "SelfPickUp_OnDemand_GrabApp", "DineIn_OnDemand_GrabApp", "Delivery_OnDemand_StoreFront", "Delivery_Scheduled_StoreFront", "SelfPickUp_OnDemand_StoreFront"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AdvancedPricing from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AdvancedPricing from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "Delivery_OnDemand_GrabApp": obj.get("Delivery_OnDemand_GrabApp"), + "Delivery_Scheduled_GrabApp": obj.get("Delivery_Scheduled_GrabApp"), + "SelfPickUp_OnDemand_GrabApp": obj.get("SelfPickUp_OnDemand_GrabApp"), + "DineIn_OnDemand_GrabApp": obj.get("DineIn_OnDemand_GrabApp"), + "Delivery_OnDemand_StoreFront": obj.get("Delivery_OnDemand_StoreFront"), + "Delivery_Scheduled_StoreFront": obj.get("Delivery_Scheduled_StoreFront"), + "SelfPickUp_OnDemand_StoreFront": obj.get("SelfPickUp_OnDemand_StoreFront") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/batch_update_menu_item.py b/grabfood/models/batch_update_menu_item.py new file mode 100644 index 0000000..34a5e43 --- /dev/null +++ b/grabfood/models/batch_update_menu_item.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.menu_entity import MenuEntity +from typing import Optional, Set +from typing_extensions import Self + +class BatchUpdateMenuItem(BaseModel): + """ + Information about the GrabFood client updating their food menu. + """ # noqa: E501 + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + var_field: StrictStr = Field(description="The record type that you want to update.", alias="field") + menu_entities: Optional[List[MenuEntity]] = Field(default=None, description="The items in an array of JSON Object. ", alias="menuEntities") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID", "field", "menuEntities"] + + @field_validator('var_field') + def var_field_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ITEM']): + raise ValueError("must be one of enum values ('ITEM')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BatchUpdateMenuItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in menu_entities (list) + _items = [] + if self.menu_entities: + for _item_menu_entities in self.menu_entities: + if _item_menu_entities: + _items.append(_item_menu_entities.to_dict()) + _dict['menuEntities'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BatchUpdateMenuItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID"), + "field": obj.get("field"), + "menuEntities": [MenuEntity.from_dict(_item) for _item in obj["menuEntities"]] if obj.get("menuEntities") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/batch_update_menu_response.py b/grabfood/models/batch_update_menu_response.py new file mode 100644 index 0000000..1cf8385 --- /dev/null +++ b/grabfood/models/batch_update_menu_response.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.menu_entity_error import MenuEntityError +from typing import Optional, Set +from typing_extensions import Self + +class BatchUpdateMenuResponse(BaseModel): + """ + BatchUpdateMenuResponse + """ # noqa: E501 + merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + status: Optional[StrictStr] = Field(default=None, description="The status of this request.") + errors: Optional[List[MenuEntityError]] = Field(default=None, description="The error messages when batch update menu record was partial success/fail. `null` when the request was success.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID", "status", "errors"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['success', 'partial success', 'fail']): + raise ValueError("must be one of enum values ('success', 'partial success', 'fail')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BatchUpdateMenuResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if errors (nullable) is None + # and model_fields_set contains the field + if self.errors is None and "errors" in self.model_fields_set: + _dict['errors'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BatchUpdateMenuResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID"), + "status": obj.get("status"), + "errors": [MenuEntityError.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/bind_membership_native_request.py b/grabfood/models/bind_membership_native_request.py new file mode 100644 index 0000000..b1d9ce7 --- /dev/null +++ b/grabfood/models/bind_membership_native_request.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class BindMembershipNativeRequest(BaseModel): + """ + This request submits membership binding request to partner. + """ # noqa: E501 + grab_id: StrictStr = Field(description="The id used to identify an unique grab user.", alias="grabID") + phone_number: Optional[StrictStr] = Field(default=None, description="Grab user phone number used to login.", alias="phoneNumber") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["grabID", "phoneNumber"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BindMembershipNativeRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BindMembershipNativeRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "grabID": obj.get("grabID"), + "phoneNumber": obj.get("phoneNumber") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/bind_membership_native_response.py b/grabfood/models/bind_membership_native_response.py new file mode 100644 index 0000000..42f429e --- /dev/null +++ b/grabfood/models/bind_membership_native_response.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class BindMembershipNativeResponse(BaseModel): + """ + This response returns membershipID after membership binding is successful. + """ # noqa: E501 + member_id: StrictStr = Field(description="The unique member ID on the partner's database.", alias="memberID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["memberID"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BindMembershipNativeResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BindMembershipNativeResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "memberID": obj.get("memberID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/campaign.py b/grabfood/models/campaign.py new file mode 100644 index 0000000..b6e9151 --- /dev/null +++ b/grabfood/models/campaign.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.campaign_conditions import CampaignConditions +from grabfood.models.campaign_discount import CampaignDiscount +from grabfood.models.campaign_quotas import CampaignQuotas +from typing import Optional, Set +from typing_extensions import Self + +class Campaign(BaseModel): + """ + A JSON object containing the campaign details for a merchant. Only campaigns that are funded by merchants will be sent. + """ # noqa: E501 + id: StrictStr = Field(description="The campaign's ID.") + created_by: StrictStr = Field(description="The party who created the campaign. Can be created by partners via API, merchants via the merchant app or Grab.", alias="createdBy") + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + name: StrictStr = Field(description="The campaign's name.") + quotas: Optional[CampaignQuotas] = None + conditions: Optional[CampaignConditions] = None + discount: Optional[CampaignDiscount] = None + custom_tag: Optional[Annotated[str, Field(strict=True, max_length=22)]] = Field(default=None, description="Specify the tag for custom bundle offer campaign. Only whitelisted partner is supported as of now.", alias="customTag") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "createdBy", "merchantID", "name", "quotas", "conditions", "discount", "customTag"] + + @field_validator('created_by') + def created_by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Grab', 'Merchant', 'Partner']): + raise ValueError("must be one of enum values ('Grab', 'Merchant', 'Partner')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Campaign from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of quotas + if self.quotas: + _dict['quotas'] = self.quotas.to_dict() + # override the default output from pydantic by calling `to_dict()` of conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # override the default output from pydantic by calling `to_dict()` of discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Campaign from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "createdBy": obj.get("createdBy"), + "merchantID": obj.get("merchantID"), + "name": obj.get("name"), + "quotas": CampaignQuotas.from_dict(obj["quotas"]) if obj.get("quotas") is not None else None, + "conditions": CampaignConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "discount": CampaignDiscount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "customTag": obj.get("customTag") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/campaign_conditions.py b/grabfood/models/campaign_conditions.py new file mode 100644 index 0000000..5c7d3c7 --- /dev/null +++ b/grabfood/models/campaign_conditions.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from grabfood.models.working_hour import WorkingHour +from typing import Optional, Set +from typing_extensions import Self + +class CampaignConditions(BaseModel): + """ + The conditions to apply to a campaign. + """ # noqa: E501 + start_time: datetime = Field(description="The campaign's start time in UTC format. For example, 2021-09-23T03:30:00Z means 2021-09-23 11:30:00 (UTC +08:00).", alias="startTime") + end_time: datetime = Field(description="The campaign's end time in UTC format.", alias="endTime") + eater_type: StrictStr = Field(description="The type of eater eligible for the campaign. * `all` - campaign will be applied to everyone. No limitation on campaign type. * `new` - campaign will be applied to consumers who have not ordered from this store in the last three months. Only applicable to **order-level** campaign. ", alias="eaterType") + min_basket_amount: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The minimum basket amount to be eligible for the campaign. Only applicable to **order-level** campaign but not to item-level discount campaign.", alias="minBasketAmount") + bundle_quantity: Optional[StrictInt] = Field(default=None, description="Specify the bundle quantity for bundle offer campaign.", alias="bundleQuantity") + working_hour: Optional[WorkingHour] = Field(default=None, alias="workingHour") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["startTime", "endTime", "eaterType", "minBasketAmount", "bundleQuantity", "workingHour"] + + @field_validator('eater_type') + def eater_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['all', 'new']): + raise ValueError("must be one of enum values ('all', 'new')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignConditions from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of working_hour + if self.working_hour: + _dict['workingHour'] = self.working_hour.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "startTime": obj.get("startTime"), + "endTime": obj.get("endTime"), + "eaterType": obj.get("eaterType"), + "minBasketAmount": obj.get("minBasketAmount"), + "bundleQuantity": obj.get("bundleQuantity"), + "workingHour": WorkingHour.from_dict(obj["workingHour"]) if obj.get("workingHour") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/campaign_discount.py b/grabfood/models/campaign_discount.py new file mode 100644 index 0000000..aa38996 --- /dev/null +++ b/grabfood/models/campaign_discount.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from grabfood.models.campaign_scope import CampaignScope +from typing import Optional, Set +from typing_extensions import Self + +class CampaignDiscount(BaseModel): + """ + The discount detail for a particular campaign when conditions are satisfied. + """ # noqa: E501 + type: StrictStr = Field(description="The type of discount ") + cap: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The maximum discount dollar amount. It is **not required** and will be ignored when the `discount.type` is: - `net` - `delivery` - `freeItem` - `bundleSameNet` - `bundleSamePercentage` - `bundleSameFixPrice` - `bundleDiffNet` - `bundleDiffPercentage` - `bundleDiffFixPrice` ") + value: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Specify the discount amount. Decimal number is not supported For VN, ID and TH. For example, `10.5` is not allowed and it should be `10.0`. * Dollar amount value when `discount.type` is `net`, `delivery`, `bundleSameNet`, `bundleSameFixPrice`, `bundleDiffNet`, `bundleDiffFixPrice`. * Percentage value (0-100) when `discount.type` is `percentage`, `bundleSamePercentage`, `bundleDiffPercentage`. * **Not required** when `discount.type` is `freeItem`. ") + scope: CampaignScope + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "cap", "value", "scope"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['net', 'percentage', 'delivery', 'freeItem', 'bundleSameNet', 'bundleSamePercentage', 'bundleSameFixPrice', 'bundleDiffNet', 'bundleDiffPercentage', 'bundleDiffFixPrice']): + raise ValueError("must be one of enum values ('net', 'percentage', 'delivery', 'freeItem', 'bundleSameNet', 'bundleSamePercentage', 'bundleSameFixPrice', 'bundleDiffNet', 'bundleDiffPercentage', 'bundleDiffFixPrice')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignDiscount from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of scope + if self.scope: + _dict['scope'] = self.scope.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignDiscount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "cap": obj.get("cap"), + "value": obj.get("value"), + "scope": CampaignScope.from_dict(obj["scope"]) if obj.get("scope") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/campaign_quotas.py b/grabfood/models/campaign_quotas.py new file mode 100644 index 0000000..c4cb01a --- /dev/null +++ b/grabfood/models/campaign_quotas.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignQuotas(BaseModel): + """ + The quotas/limits for a particular campaign. + """ # noqa: E501 + total_count: Optional[StrictInt] = Field(default=None, description="The maximum number of redemptions. Default is unlimited if unspecified. ", alias="totalCount") + total_count_per_user: Optional[StrictInt] = Field(default=None, description="The maximum number of redemptions per user. Default is unlimited if unspecified.", alias="totalCountPerUser") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["totalCount", "totalCountPerUser"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignQuotas from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignQuotas from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "totalCount": obj.get("totalCount"), + "totalCountPerUser": obj.get("totalCountPerUser") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/campaign_scope.py b/grabfood/models/campaign_scope.py new file mode 100644 index 0000000..5c3db47 --- /dev/null +++ b/grabfood/models/campaign_scope.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignScope(BaseModel): + """ + The scope level for a particular campaign. + """ # noqa: E501 + type: StrictStr = Field(description="The scope type for this campaign. * `order` - order level campaign. * `items` - item level campaign or bundle offer. * `category` - category level campaign where all items within applies the same discount. ") + object_ids: Optional[List[StrictStr]] = Field(default=None, description="The list of item IDs in the partner's database applicable for discount when `discount.scope.type` is `items` (or category IDs for `category`). One and only 1 item supported when `discount.type` is: - `freeItem` - `bundleSameNet` - `bundleSamePercentage` - `bundleSameFixPrice` Minimum 2 - Maximum 20 items supported when `discount.type` is: - `bundleDiffNet` - `bundleDiffPercentage` - `bundleDiffFixPrice` ", alias="objectIDs") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "objectIDs"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['order', 'items', 'category']): + raise ValueError("must be one of enum values ('order', 'items', 'category')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignScope from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignScope from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "objectIDs": obj.get("objectIDs") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/cancel_code.py b/grabfood/models/cancel_code.py new file mode 100644 index 0000000..9799d1a --- /dev/null +++ b/grabfood/models/cancel_code.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class CancelCode(int, Enum): + """ + The cancel code for a specific cancel reason. + """ + + """ + allowed enum values + """ + NUMBER_1001 = 1001 + NUMBER_1002 = 1002 + NUMBER_1003 = 1003 + NUMBER_1004 = 1004 + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CancelCode from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/grabfood/models/cancel_order_limit_type.py b/grabfood/models/cancel_order_limit_type.py new file mode 100644 index 0000000..e6aa2e2 --- /dev/null +++ b/grabfood/models/cancel_order_limit_type.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class CancelOrderLimitType(str, Enum): + """ + The type of the order cancellation limit. + """ + + """ + allowed enum values + """ + NOT_APPROACHING_LIMIT = 'not approaching limit' + APPROACHING_THE_DAILY_LIMIT = 'approaching the daily limit' + APPROACHING_THE_WEEKLY_LIMIT = 'approaching the weekly limit' + APPROACHING_THE_MONTHLY_LIMIT = 'approaching the monthly limit' + EMPTY = '' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CancelOrderLimitType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/grabfood/models/cancel_order_request.py b/grabfood/models/cancel_order_request.py new file mode 100644 index 0000000..5f89831 --- /dev/null +++ b/grabfood/models/cancel_order_request.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from grabfood.models.cancel_code import CancelCode +from typing import Optional, Set +from typing_extensions import Self + +class CancelOrderRequest(BaseModel): + """ + This request cancels an order on GrabFood. + """ # noqa: E501 + order_id: StrictStr = Field(description="The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="orderID") + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + cancel_code: CancelCode = Field(alias="cancelCode") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["orderID", "merchantID", "cancelCode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CancelOrderRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CancelOrderRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "orderID": obj.get("orderID"), + "merchantID": obj.get("merchantID"), + "cancelCode": obj.get("cancelCode") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/cancel_order_response.py b/grabfood/models/cancel_order_response.py new file mode 100644 index 0000000..f3d2276 --- /dev/null +++ b/grabfood/models/cancel_order_response.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.cancel_order_limit_type import CancelOrderLimitType +from typing import Optional, Set +from typing_extensions import Self + +class CancelOrderResponse(BaseModel): + """ + + """ # noqa: E501 + limit_type: Optional[CancelOrderLimitType] = Field(default=None, alias="limitType") + limit_times: Optional[StrictInt] = Field(default=None, description="The remaining cancellation quota for the merchant. A value is only returned when the nearest remaining cancellation limit is approaching, else it returns 0.", alias="limitTimes") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["limitType", "limitTimes"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CancelOrderResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CancelOrderResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "limitType": obj.get("limitType"), + "limitTimes": obj.get("limitTimes") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/cancel_reason.py b/grabfood/models/cancel_reason.py new file mode 100644 index 0000000..e5b7c79 --- /dev/null +++ b/grabfood/models/cancel_reason.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.cancel_code import CancelCode +from typing import Optional, Set +from typing_extensions import Self + +class CancelReason(BaseModel): + """ + CancelReason + """ # noqa: E501 + code: Optional[CancelCode] = None + reason: Optional[StrictStr] = Field(default=None, description="The detailed cancel reason for the specific cancel code. - Items are unavailable - I have too many orders now - My shop is closed - My shop is closing soon ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "reason"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CancelReason from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CancelReason from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "reason": obj.get("reason") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/check_order_cancelable_response.py b/grabfood/models/check_order_cancelable_response.py new file mode 100644 index 0000000..71df9ae --- /dev/null +++ b/grabfood/models/check_order_cancelable_response.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.cancel_order_limit_type import CancelOrderLimitType +from grabfood.models.cancel_reason import CancelReason +from typing import Optional, Set +from typing_extensions import Self + +class CheckOrderCancelableResponse(BaseModel): + """ + + """ # noqa: E501 + cancel_able: Optional[StrictBool] = Field(default=None, description="The boolean value to indicate whether an order can be cancelled.", alias="cancelAble") + non_cancellation_reason: Optional[StrictStr] = Field(default=None, description="The reason for the order to be non-cancelable.", alias="nonCancellationReason") + limit_type: Optional[CancelOrderLimitType] = Field(default=None, alias="limitType") + limit_times: Optional[StrictInt] = Field(default=None, description="The remaining cancellation quota for the merchant. A value is only returned when the nearest remaining cancellation limit is approaching, else it returns 0.", alias="limitTimes") + cancel_reasons: Optional[List[CancelReason]] = Field(default=None, description="An array of cancel order reasons JSON objects.", alias="cancelReasons") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["cancelAble", "nonCancellationReason", "limitType", "limitTimes", "cancelReasons"] + + @field_validator('non_cancellation_reason') + def non_cancellation_reason_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GKMM (Grab Kitchen Mix & Match) orders cannot be cancelled', 'Self pick-up orders cannot be cancelled', 'Scheduled orders cannot be cancelled', 'Daily cancellation limit reached', 'Weekly cancellation limit reached', 'Monthly cancellation limit reached', 'Driver has been allocated for too long', 'Driver App version is outdated preventing cancellation', 'Order has not yet been allocated preventing cancellation', 'The current status of the order does not allow cancellation', 'Default Error', '']): + raise ValueError("must be one of enum values ('GKMM (Grab Kitchen Mix & Match) orders cannot be cancelled', 'Self pick-up orders cannot be cancelled', 'Scheduled orders cannot be cancelled', 'Daily cancellation limit reached', 'Weekly cancellation limit reached', 'Monthly cancellation limit reached', 'Driver has been allocated for too long', 'Driver App version is outdated preventing cancellation', 'Order has not yet been allocated preventing cancellation', 'The current status of the order does not allow cancellation', 'Default Error', '')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CheckOrderCancelableResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in cancel_reasons (list) + _items = [] + if self.cancel_reasons: + for _item_cancel_reasons in self.cancel_reasons: + if _item_cancel_reasons: + _items.append(_item_cancel_reasons.to_dict()) + _dict['cancelReasons'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CheckOrderCancelableResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cancelAble": obj.get("cancelAble"), + "nonCancellationReason": obj.get("nonCancellationReason"), + "limitType": obj.get("limitType"), + "limitTimes": obj.get("limitTimes"), + "cancelReasons": [CancelReason.from_dict(_item) for _item in obj["cancelReasons"]] if obj.get("cancelReasons") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/coordinates.py b/grabfood/models/coordinates.py new file mode 100644 index 0000000..c3326fe --- /dev/null +++ b/grabfood/models/coordinates.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class Coordinates(BaseModel): + """ + A JSON object containing the coordinates of the delivery address. Only has value when poiSource is `GRAB`. + """ # noqa: E501 + latitude: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The latitude coordinates of the delivery address.") + longitude: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The longitude coordinates of the delivery address.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["latitude", "longitude"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Coordinates from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Coordinates from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "latitude": obj.get("latitude"), + "longitude": obj.get("longitude") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/create_campaign_request.py b/grabfood/models/create_campaign_request.py new file mode 100644 index 0000000..78477ea --- /dev/null +++ b/grabfood/models/create_campaign_request.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.campaign_conditions import CampaignConditions +from grabfood.models.campaign_discount import CampaignDiscount +from grabfood.models.campaign_quotas import CampaignQuotas +from typing import Optional, Set +from typing_extensions import Self + +class CreateCampaignRequest(BaseModel): + """ + This request creates a campaign for your GrabFood store. + """ # noqa: E501 + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + name: StrictStr = Field(description="The campaign's name.") + quotas: Optional[CampaignQuotas] = None + conditions: CampaignConditions + discount: CampaignDiscount + custom_tag: Optional[Annotated[str, Field(strict=True, max_length=22)]] = Field(default=None, description="Specify the tag for custom bundle offer campaign. Only whitelisted partner is supported as of now.", alias="customTag") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID", "name", "quotas", "conditions", "discount", "customTag"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateCampaignRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of quotas + if self.quotas: + _dict['quotas'] = self.quotas.to_dict() + # override the default output from pydantic by calling `to_dict()` of conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # override the default output from pydantic by calling `to_dict()` of discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateCampaignRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID"), + "name": obj.get("name"), + "quotas": CampaignQuotas.from_dict(obj["quotas"]) if obj.get("quotas") is not None else None, + "conditions": CampaignConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "discount": CampaignDiscount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "customTag": obj.get("customTag") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/create_campaign_response.py b/grabfood/models/create_campaign_response.py new file mode 100644 index 0000000..86d644f --- /dev/null +++ b/grabfood/models/create_campaign_response.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CreateCampaignResponse(BaseModel): + """ + + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The campaign's ID.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateCampaignResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateCampaignResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/create_self_serve_journey_request.py b/grabfood/models/create_self_serve_journey_request.py new file mode 100644 index 0000000..4d66989 --- /dev/null +++ b/grabfood/models/create_self_serve_journey_request.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from grabfood.models.create_self_serve_journey_request_partner import CreateSelfServeJourneyRequestPartner +from typing import Optional, Set +from typing_extensions import Self + +class CreateSelfServeJourneyRequest(BaseModel): + """ + + """ # noqa: E501 + partner: CreateSelfServeJourneyRequestPartner + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["partner"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateSelfServeJourneyRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of partner + if self.partner: + _dict['partner'] = self.partner.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateSelfServeJourneyRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "partner": CreateSelfServeJourneyRequestPartner.from_dict(obj["partner"]) if obj.get("partner") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/create_self_serve_journey_request_partner.py b/grabfood/models/create_self_serve_journey_request_partner.py new file mode 100644 index 0000000..d0df0e9 --- /dev/null +++ b/grabfood/models/create_self_serve_journey_request_partner.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class CreateSelfServeJourneyRequestPartner(BaseModel): + """ + A JSON object containing store information + """ # noqa: E501 + merchant_id: StrictStr = Field(description="The merchant's ID that is on the partner's database.", alias="merchantID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateSelfServeJourneyRequestPartner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateSelfServeJourneyRequestPartner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/create_self_serve_journey_response.py b/grabfood/models/create_self_serve_journey_response.py new file mode 100644 index 0000000..3864761 --- /dev/null +++ b/grabfood/models/create_self_serve_journey_response.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class CreateSelfServeJourneyResponse(BaseModel): + """ + + """ # noqa: E501 + activation_url: StrictStr = Field(description="A JSON object containing store information", alias="activationUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["activationUrl"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateSelfServeJourneyResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateSelfServeJourneyResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "activationUrl": obj.get("activationUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/currency.py b/grabfood/models/currency.py new file mode 100644 index 0000000..f5f3624 --- /dev/null +++ b/grabfood/models/currency.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, field_validator +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class Currency(BaseModel): + """ + A JSON object containing code, symbol, and exponent for a given currency. Refer to [Country and Currency](#section/Getting-started/Country-and-currency). + """ # noqa: E501 + code: Annotated[str, Field(strict=True, max_length=3)] = Field(description="The three-letter ISO currency code. This is the currency that is associated with the payment amount. ") + symbol: Annotated[str, Field(strict=True, max_length=3)] = Field(description="The currency symbol. ") + exponent: StrictInt = Field(description="The log base 10 of the number of times we have to multiply the major unit to get the minor unit. Should be 0 for VN and 2 for other countries (SG/MY/ID/TH/PH/KH). ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "symbol", "exponent"] + + @field_validator('code') + def code_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['IDR', 'MYR', 'PHP', 'SGD', 'THB', 'VND']): + raise ValueError("must be one of enum values ('IDR', 'MYR', 'PHP', 'SGD', 'THB', 'VND')") + return value + + @field_validator('symbol') + def symbol_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Rp', 'RM', '₱', 'S$', '฿', '₫']): + raise ValueError("must be one of enum values ('Rp', 'RM', '₱', 'S$', '฿', '₫')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Currency from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Currency from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "symbol": obj.get("symbol"), + "exponent": obj.get("exponent") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/dine_in.py b/grabfood/models/dine_in.py new file mode 100644 index 0000000..db28358 --- /dev/null +++ b/grabfood/models/dine_in.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DineIn(BaseModel): + """ + A JSON object containing order at table information. Only applicable for dine-in order. `null` if not applicable. Not present in [ListOrder](#tag/list-order/operation/list-orders) response. + """ # noqa: E501 + table_id: Optional[StrictStr] = Field(default=None, description="Table number.", alias="tableID") + eater_count: Optional[StrictInt] = Field(default=None, description="The number of eaters.", alias="eaterCount") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["tableID", "eaterCount"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DineIn from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DineIn from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tableID": obj.get("tableID"), + "eaterCount": obj.get("eaterCount") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/edit_order_item.py b/grabfood/models/edit_order_item.py new file mode 100644 index 0000000..d195244 --- /dev/null +++ b/grabfood/models/edit_order_item.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EditOrderItem(BaseModel): + """ + EditOrderItem + """ # noqa: E501 + item_id: StrictStr = Field(description="The item's ID in Grab system that can be obtained from the [Submit Order Webhook](#tag/submit-order-webhook/operation/submit-order-webhook) request payload parameters under `items[].grabItemID`, or `items[].outOfStockInstruction.replacementGrabItemID` for item replacement. External item ID from Partner system is only supported when `ADDED` status and `isExternalItemID: true`.", alias="itemID") + status: StrictStr = Field(description="The item's edited status. Leave empty string if there is no change to the item.") + quantity: Optional[StrictInt] = Field(default=None, description="The item's quantity. If the item is not being updated or deleted, use the original quantity.") + is_external_item_id: Optional[StrictBool] = Field(default=None, description="Only applicable for `ADDED`status. Indicate if the `itemID` is an external item ID. Grab checks for the items that are mapped to the provided item ID, considering their availability. If multiple Grab items are found to be mapped to the provided external item ID, the last updated item will be chosen. If no suitable record is found, an 400 error will be returned to the partner, indicating that the submitted external item ID cannot be edited.", alias="isExternalItemID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["itemID", "status", "quantity", "isExternalItemID"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['DELETED', 'UPDATED', 'ADDED', '']): + raise ValueError("must be one of enum values ('DELETED', 'UPDATED', 'ADDED', '')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EditOrderItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EditOrderItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "itemID": obj.get("itemID"), + "status": obj.get("status"), + "quantity": obj.get("quantity"), + "isExternalItemID": obj.get("isExternalItemID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/edit_order_request.py b/grabfood/models/edit_order_request.py new file mode 100644 index 0000000..cc2c475 --- /dev/null +++ b/grabfood/models/edit_order_request.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.edit_order_item import EditOrderItem +from typing import Optional, Set +from typing_extensions import Self + +class EditOrderRequest(BaseModel): + """ + Information about editing an existing order on GrabFood. + """ # noqa: E501 + order_id: StrictStr = Field(description="The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="orderID") + items: List[EditOrderItem] = Field(description="Specify the array of all items in the order, including deleted, added, updated and unchanged items.") + only_recalculate: Optional[StrictBool] = Field(default=None, description="This parameter specifies whether to recalculate the edited order without submitting it. It is intended for testing purposes only. This parameter is set to false by default, which means the edited order will be recalculated and re-submitted to partners. ", alias="onlyRecalculate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["orderID", "items", "onlyRecalculate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EditOrderRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EditOrderRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "orderID": obj.get("orderID"), + "items": [EditOrderItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "onlyRecalculate": obj.get("onlyRecalculate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/error.py b/grabfood/models/error.py new file mode 100644 index 0000000..b8a60c5 --- /dev/null +++ b/grabfood/models/error.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class Error(BaseModel): + """ + Error + """ # noqa: E501 + target: Optional[StrictStr] = Field(default=None, description="Target of error") + reason: Optional[StrictStr] = Field(default=None, description="The type of error.") + message: Optional[StrictStr] = Field(default=None, description="The details of the error.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["target", "reason", "message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Error from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Error from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "target": obj.get("target"), + "reason": obj.get("reason"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/get_dine_in_voucher_response.py b/grabfood/models/get_dine_in_voucher_response.py new file mode 100644 index 0000000..1127acd --- /dev/null +++ b/grabfood/models/get_dine_in_voucher_response.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.voucher import Voucher +from typing import Optional, Set +from typing_extensions import Self + +class GetDineInVoucherResponse(BaseModel): + """ + + """ # noqa: E501 + certificate_id: Optional[StrictStr] = Field(default=None, description="This certificateID is decoded from scanning the QR code, and 1:1 mapping with `voucherCode`.", alias="certificateID") + voucher_code: Optional[Annotated[str, Field(strict=True, max_length=11)]] = Field(default=None, description="A short code for the dine-in voucher purchased by the user.", alias="voucherCode") + voucher: Optional[Voucher] = None + voucher_status: Optional[StrictStr] = Field(default=None, description="The status of the dine-in voucher purchased. Only active voucher is eligible for redemption.", alias="voucherStatus") + merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + campaign_id: Optional[StrictStr] = Field(default=None, description="The dine-in voucher campaign's ID in GrabFood's database.", alias="campaignID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["certificateID", "voucherCode", "voucher", "voucherStatus", "merchantID", "campaignID"] + + @field_validator('voucher_status') + def voucher_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ACTIVE', 'REDEEMED', 'EXPIRED', 'REFUNDED']): + raise ValueError("must be one of enum values ('ACTIVE', 'REDEEMED', 'EXPIRED', 'REFUNDED')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetDineInVoucherResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetDineInVoucherResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "certificateID": obj.get("certificateID"), + "voucherCode": obj.get("voucherCode"), + "voucher": Voucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "voucherStatus": obj.get("voucherStatus"), + "merchantID": obj.get("merchantID"), + "campaignID": obj.get("campaignID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/get_membership_native_response.py b/grabfood/models/get_membership_native_response.py new file mode 100644 index 0000000..2861887 --- /dev/null +++ b/grabfood/models/get_membership_native_response.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.get_membership_native_response_point_info import GetMembershipNativeResponsePointInfo +from typing import Optional, Set +from typing_extensions import Self + +class GetMembershipNativeResponse(BaseModel): + """ + This response returns membership detail. + """ # noqa: E501 + membership_status: Optional[StrictStr] = Field(default=None, description="Status of the memberID.", alias="membershipStatus") + point_info: Optional[GetMembershipNativeResponsePointInfo] = Field(default=None, alias="pointInfo") + points_expire_date: Optional[StrictStr] = Field(default=None, description="Earliest points expiry date. In `yyyy-mm-dd` format", alias="pointsExpireDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["membershipStatus", "pointInfo", "pointsExpireDate"] + + @field_validator('membership_status') + def membership_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['VALID', 'INVALID']): + raise ValueError("must be one of enum values ('VALID', 'INVALID')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetMembershipNativeResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of point_info + if self.point_info: + _dict['pointInfo'] = self.point_info.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetMembershipNativeResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "membershipStatus": obj.get("membershipStatus"), + "pointInfo": GetMembershipNativeResponsePointInfo.from_dict(obj["pointInfo"]) if obj.get("pointInfo") is not None else None, + "pointsExpireDate": obj.get("pointsExpireDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/get_membership_native_response_point_info.py b/grabfood/models/get_membership_native_response_point_info.py new file mode 100644 index 0000000..ca55da0 --- /dev/null +++ b/grabfood/models/get_membership_native_response_point_info.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class GetMembershipNativeResponsePointInfo(BaseModel): + """ + Obtain contains user's point details. + """ # noqa: E501 + current_points: Optional[StrictInt] = Field(default=None, description="Point that user currently obtained.", alias="currentPoints") + max_points: Optional[StrictInt] = Field(default=None, description="Maximum point that user can obtain.", alias="maxPoints") + expire_points: Optional[StrictInt] = Field(default=None, description="Points that would get expired in future.", alias="expirePoints") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["currentPoints", "maxPoints", "expirePoints"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetMembershipNativeResponsePointInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetMembershipNativeResponsePointInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "currentPoints": obj.get("currentPoints"), + "maxPoints": obj.get("maxPoints"), + "expirePoints": obj.get("expirePoints") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/get_membership_request.py b/grabfood/models/get_membership_request.py new file mode 100644 index 0000000..e212d16 --- /dev/null +++ b/grabfood/models/get_membership_request.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class GetMembershipRequest(BaseModel): + """ + This request submits membership unbind request to partner. + """ # noqa: E501 + member_id: StrictStr = Field(description="The unique member ID on the partner's database.", alias="memberID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["memberID"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetMembershipRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetMembershipRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "memberID": obj.get("memberID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/get_membership_webview_response.py b/grabfood/models/get_membership_webview_response.py new file mode 100644 index 0000000..9a6fb8a --- /dev/null +++ b/grabfood/models/get_membership_webview_response.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class GetMembershipWebviewResponse(BaseModel): + """ + This response returns membership detail. + """ # noqa: E501 + membership_status: Optional[StrictStr] = Field(default=None, description="Status of the memberID.", alias="membershipStatus") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["membershipStatus"] + + @field_validator('membership_status') + def membership_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['VALID', 'INVALID']): + raise ValueError("must be one of enum values ('VALID', 'INVALID')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetMembershipWebviewResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetMembershipWebviewResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "membershipStatus": obj.get("membershipStatus") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/get_menu_new_response.py b/grabfood/models/get_menu_new_response.py new file mode 100644 index 0000000..1a6bf4b --- /dev/null +++ b/grabfood/models/get_menu_new_response.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.currency import Currency +from grabfood.models.menu_category import MenuCategory +from grabfood.models.selling_time import SellingTime +from typing import Optional, Set +from typing_extensions import Self + +class GetMenuNewResponse(BaseModel): + """ + + """ # noqa: E501 + merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + partner_merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is on the partner's database.", alias="partnerMerchantID") + currency: Currency + selling_times: List[SellingTime] = Field(description="An array of sellingTimes JSON objects. Max 20 allowed. Refer to [Selling Times](#selling-times) for more information.", alias="sellingTimes") + categories: List[MenuCategory] = Field(description="An array of category JSON objects. Max 100 allowed. Refer to [Categories](#categories) for more information.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID", "partnerMerchantID", "currency", "sellingTimes", "categories"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetMenuNewResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of currency + if self.currency: + _dict['currency'] = self.currency.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in selling_times (list) + _items = [] + if self.selling_times: + for _item_selling_times in self.selling_times: + if _item_selling_times: + _items.append(_item_selling_times.to_dict()) + _dict['sellingTimes'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetMenuNewResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID"), + "partnerMerchantID": obj.get("partnerMerchantID"), + "currency": Currency.from_dict(obj["currency"]) if obj.get("currency") is not None else None, + "sellingTimes": [SellingTime.from_dict(_item) for _item in obj["sellingTimes"]] if obj.get("sellingTimes") is not None else None, + "categories": [MenuCategory.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/get_menu_old_response.py b/grabfood/models/get_menu_old_response.py new file mode 100644 index 0000000..88ae7d3 --- /dev/null +++ b/grabfood/models/get_menu_old_response.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.currency import Currency +from grabfood.models.menu_section import MenuSection +from typing import Optional, Set +from typing_extensions import Self + +class GetMenuOldResponse(BaseModel): + """ + + """ # noqa: E501 + merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + partner_merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is on the partner's database.", alias="partnerMerchantID") + currency: Currency + sections: List[MenuSection] = Field(description="An array of section JSON objects. Max 7 allowed. Refer to [Sections](#sections) for more information.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID", "partnerMerchantID", "currency", "sections"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetMenuOldResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of currency + if self.currency: + _dict['currency'] = self.currency.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in sections (list) + _items = [] + if self.sections: + for _item_sections in self.sections: + if _item_sections: + _items.append(_item_sections.to_dict()) + _dict['sections'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetMenuOldResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID"), + "partnerMerchantID": obj.get("partnerMerchantID"), + "currency": Currency.from_dict(obj["currency"]) if obj.get("currency") is not None else None, + "sections": [MenuSection.from_dict(_item) for _item in obj["sections"]] if obj.get("sections") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/get_reward_native_request.py b/grabfood/models/get_reward_native_request.py new file mode 100644 index 0000000..cd59f5b --- /dev/null +++ b/grabfood/models/get_reward_native_request.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.reward_item import RewardItem +from typing import Optional, Set +from typing_extensions import Self + +class GetRewardNativeRequest(BaseModel): + """ + This request submits membership detail and order value to get reward calculation. + """ # noqa: E501 + member_id: Optional[StrictStr] = Field(default=None, description="The unique member ID on the partner's database.", alias="memberID") + merchant_id: Optional[StrictStr] = Field(default=None, description="Grab merchant's ID.", alias="merchantID") + items: Optional[List[RewardItem]] = None + order_value: Optional[StrictInt] = Field(default=None, description="The post-discount order value.", alias="orderValue") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["memberID", "merchantID", "items", "orderValue"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetRewardNativeRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetRewardNativeRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "memberID": obj.get("memberID"), + "merchantID": obj.get("merchantID"), + "items": [RewardItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "orderValue": obj.get("orderValue") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/get_reward_native_response.py b/grabfood/models/get_reward_native_response.py new file mode 100644 index 0000000..bedcf2e --- /dev/null +++ b/grabfood/models/get_reward_native_response.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class GetRewardNativeResponse(BaseModel): + """ + This response returns reward points earn for this order. + """ # noqa: E501 + points: StrictInt = Field(description="The reward points earned in this purchase.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetRewardNativeResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetRewardNativeResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/grab_oauth_request.py b/grabfood/models/grab_oauth_request.py new file mode 100644 index 0000000..11dacb5 --- /dev/null +++ b/grabfood/models/grab_oauth_request.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class GrabOauthRequest(BaseModel): + """ + Information about the GrabFood client getting an OAuth 2.0 access token from partners. + """ # noqa: E501 + client_id: Annotated[str, Field(strict=True, max_length=32)] = Field(description="The client identifier issued to the client to obtain the OAuth 2.0 access_token.") + client_secret: Annotated[str, Field(strict=True, max_length=32)] = Field(description="The client secret issued to the client to obtain the OAuth 2.0 access_token.") + grant_type: StrictStr = Field(description="The grant type for the client to obtain the OAuth 2.0 access_token.") + scope: StrictStr = Field(description="The scope for the client to obtain the OAuth 2.0 access_token.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["client_id", "client_secret", "grant_type", "scope"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GrabOauthRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GrabOauthRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "client_id": obj.get("client_id"), + "client_secret": obj.get("client_secret"), + "grant_type": obj.get("grant_type"), + "scope": obj.get("scope") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/grab_oauth_response.py b/grabfood/models/grab_oauth_response.py new file mode 100644 index 0000000..f937911 --- /dev/null +++ b/grabfood/models/grab_oauth_response.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class GrabOauthResponse(BaseModel): + """ + GrabOauthResponse + """ # noqa: E501 + access_token: Optional[StrictStr] = Field(default=None, description="The OAuth 2.0 access token issued by the partner.") + token_type: Optional[StrictStr] = Field(default=None, description="The type of token issued which is case insensitive.") + expires_in: Optional[StrictInt] = Field(default=None, description="The access token lifespan in seconds. The token is reused till it expires - default is 604799 (7 days).") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["access_token", "token_type", "expires_in"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GrabOauthResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GrabOauthResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "access_token": obj.get("access_token"), + "token_type": obj.get("token_type"), + "expires_in": obj.get("expires_in") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/list_campaign_response.py b/grabfood/models/list_campaign_response.py new file mode 100644 index 0000000..1efb278 --- /dev/null +++ b/grabfood/models/list_campaign_response.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.campaign import Campaign +from typing import Optional, Set +from typing_extensions import Self + +class ListCampaignResponse(BaseModel): + """ + + """ # noqa: E501 + ongoing: Optional[List[Campaign]] = None + upcoming: Optional[List[Campaign]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["ongoing", "upcoming"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListCampaignResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in ongoing (list) + _items = [] + if self.ongoing: + for _item_ongoing in self.ongoing: + if _item_ongoing: + _items.append(_item_ongoing.to_dict()) + _dict['ongoing'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in upcoming (list) + _items = [] + if self.upcoming: + for _item_upcoming in self.upcoming: + if _item_upcoming: + _items.append(_item_upcoming.to_dict()) + _dict['upcoming'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListCampaignResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ongoing": [Campaign.from_dict(_item) for _item in obj["ongoing"]] if obj.get("ongoing") is not None else None, + "upcoming": [Campaign.from_dict(_item) for _item in obj["upcoming"]] if obj.get("upcoming") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/list_orders_response.py b/grabfood/models/list_orders_response.py new file mode 100644 index 0000000..b1c31ee --- /dev/null +++ b/grabfood/models/list_orders_response.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.order import Order +from typing import Optional, Set +from typing_extensions import Self + +class ListOrdersResponse(BaseModel): + """ + + """ # noqa: E501 + more: Optional[StrictBool] = Field(default=None, description="The boolean value to indicate if there is more order data. If `true`, you can continue requesting with page+1.") + orders: Optional[List[Order]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["more", "orders"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListOrdersResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in orders (list) + _items = [] + if self.orders: + for _item_orders in self.orders: + if _item_orders: + _items.append(_item_orders.to_dict()) + _dict['orders'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListOrdersResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "more": obj.get("more"), + "orders": [Order.from_dict(_item) for _item in obj["orders"]] if obj.get("orders") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/mark_order_request.py b/grabfood/models/mark_order_request.py new file mode 100644 index 0000000..778b3ff --- /dev/null +++ b/grabfood/models/mark_order_request.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class MarkOrderRequest(BaseModel): + """ + This request marks an order as ready for delivery or completed on GrabFood. + """ # noqa: E501 + order_id: StrictStr = Field(description="The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="orderID") + mark_status: StrictInt = Field(description="The status to be marked accordingly. * `1` - mark order as ready * `2` - mark order as completed and only applicable to **dine-in** orders ", alias="markStatus") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["orderID", "markStatus"] + + @field_validator('mark_status') + def mark_status_validate_enum(cls, value): + """Validates the enum""" + if value not in set([1, 2]): + raise ValueError("must be one of enum values (1, 2)") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MarkOrderRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MarkOrderRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "orderID": obj.get("orderID"), + "markStatus": obj.get("markStatus") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_category.py b/grabfood/models/menu_category.py new file mode 100644 index 0000000..9a06431 --- /dev/null +++ b/grabfood/models/menu_category.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.menu_item import MenuItem +from typing import Optional, Set +from typing_extensions import Self + +class MenuCategory(BaseModel): + """ + MenuCategory + """ # noqa: E501 + id: Annotated[str, Field(strict=True, max_length=64)] = Field(description="The category's ID that is on the partner system. This ID should be unique.") + name: Annotated[str, Field(strict=True, max_length=60)] = Field(description="The name of the category.") + name_translation: Optional[Dict[str, StrictStr]] = Field(default=None, description="Translation of the category name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation).", alias="nameTranslation") + available_status: StrictStr = Field(description="The status for the category. Refer to FAQs for more details about [availableStatus](#section/Menu/What-is-availableStatus).", alias="availableStatus") + selling_time_id: StrictStr = Field(description="The selling time's ID for the category. All items within the category will apply the same selling time unless there is another selling time specified for the item.", alias="sellingTimeID") + sequence: Optional[StrictInt] = Field(default=None, description="The sort or display order of the category within the menu.") + items: List[MenuItem] = Field(description="An array of item JSON objects. Max 300 allowed per category. Refer to [Items](#items) for more information.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "nameTranslation", "availableStatus", "sellingTimeID", "sequence", "items"] + + @field_validator('available_status') + def available_status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['AVAILABLE', 'UNAVAILABLE', 'HIDE']): + raise ValueError("must be one of enum values ('AVAILABLE', 'UNAVAILABLE', 'HIDE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuCategory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuCategory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "nameTranslation": obj.get("nameTranslation"), + "availableStatus": obj.get("availableStatus"), + "sellingTimeID": obj.get("sellingTimeID"), + "sequence": obj.get("sequence"), + "items": [MenuItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_entity.py b/grabfood/models/menu_entity.py new file mode 100644 index 0000000..36938ba --- /dev/null +++ b/grabfood/models/menu_entity.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.update_advanced_pricing import UpdateAdvancedPricing +from grabfood.models.update_purchasability import UpdatePurchasability +from typing import Optional, Set +from typing_extensions import Self + +class MenuEntity(BaseModel): + """ + MenuEntity + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The record's ID on the partner system. For example, the item id in case type is ITEM, modifier id is MODIFIER.") + price: Optional[StrictInt] = Field(default=None, description="The record's price in minor unit format.") + available_status: Optional[StrictStr] = Field(default=None, description="The record's availableStatus. Note: In order to set an item as \"UNAVAILABLE\", it is required to update both the `availableStatus` and `maxStock` fields, whereby the `maxStock` value should be set to 0. ", alias="availableStatus") + max_stock: Optional[StrictInt] = Field(default=None, description="Available stocks under inventory for this item. Auto reduce when there is order placed for this item. Note: It is necessary to set `maxStock` to 0 if the `availableStatus` of the item is \"UNAVAILABLE\". Item will be set to \"AVAILABLE\" if `maxStock` > 0. ", alias="maxStock") + advanced_pricings: Optional[List[UpdateAdvancedPricing]] = Field(default=None, description="Price configuration (in minor unit) for different service, order type and channel combination. If a service type does not have a specified price, it will utilize the default price of the item. ", alias="advancedPricings") + purchasabilities: Optional[List[UpdatePurchasability]] = Field(default=None, description="Purchasability is set to true by default for all service type, unless it is explicitly set to false. Modifier will reuse it’s item’s purchasability. ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "price", "availableStatus", "maxStock", "advancedPricings", "purchasabilities"] + + @field_validator('available_status') + def available_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AVAILABLE', 'UNAVAILABLE', 'UNAVAILABLETODAY']): + raise ValueError("must be one of enum values ('AVAILABLE', 'UNAVAILABLE', 'UNAVAILABLETODAY')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuEntity from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in advanced_pricings (list) + _items = [] + if self.advanced_pricings: + for _item_advanced_pricings in self.advanced_pricings: + if _item_advanced_pricings: + _items.append(_item_advanced_pricings.to_dict()) + _dict['advancedPricings'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in purchasabilities (list) + _items = [] + if self.purchasabilities: + for _item_purchasabilities in self.purchasabilities: + if _item_purchasabilities: + _items.append(_item_purchasabilities.to_dict()) + _dict['purchasabilities'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "price": obj.get("price"), + "availableStatus": obj.get("availableStatus"), + "maxStock": obj.get("maxStock"), + "advancedPricings": [UpdateAdvancedPricing.from_dict(_item) for _item in obj["advancedPricings"]] if obj.get("advancedPricings") is not None else None, + "purchasabilities": [UpdatePurchasability.from_dict(_item) for _item in obj["purchasabilities"]] if obj.get("purchasabilities") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_entity_error.py b/grabfood/models/menu_entity_error.py new file mode 100644 index 0000000..817fc39 --- /dev/null +++ b/grabfood/models/menu_entity_error.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class MenuEntityError(BaseModel): + """ + MenuEntityError + """ # noqa: E501 + entity_id: Optional[StrictStr] = Field(default=None, description="The itemID.", alias="entityID") + err_msg: Optional[StrictStr] = Field(default=None, description="The error message.", alias="errMsg") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["entityID", "errMsg"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuEntityError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuEntityError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "entityID": obj.get("entityID"), + "errMsg": obj.get("errMsg") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_item.py b/grabfood/models/menu_item.py new file mode 100644 index 0000000..6508024 --- /dev/null +++ b/grabfood/models/menu_item.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.advanced_pricing import AdvancedPricing +from grabfood.models.modifier_group import ModifierGroup +from grabfood.models.purchasability import Purchasability +from typing import Optional, Set +from typing_extensions import Self + +class MenuItem(BaseModel): + """ + MenuItem + """ # noqa: E501 + id: Annotated[str, Field(strict=True, max_length=64)] = Field(description="The item's ID in the partner system. This ID should be unique. ") + name: Annotated[str, Field(strict=True, max_length=80)] = Field(description="The name of the item.") + name_translation: Optional[Dict[str, StrictStr]] = Field(default=None, description="Translation of the item name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation).", alias="nameTranslation") + available_status: StrictStr = Field(description="The status for the item. Refer to FAQs for more details about [availableStatus](#section/Menu/What-is-availableStatus). > Note: In order to set an item as `\"UNAVAILABLE\"`, it is required to update both the `availableStatus` and `maxStock` fields, whereby the `maxStock` should be set to 0. ", alias="availableStatus") + description: Optional[Annotated[str, Field(strict=True, max_length=300)]] = Field(default=None, description="The description of the item. There is a custom length limit of 2000 for `VN`. ") + description_translation: Optional[Dict[str, StrictStr]] = Field(default=None, description="Translation of the item description. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation).", alias="descriptionTranslation") + price: StrictInt = Field(description="The item's price in minor format. For example: 1900 means $19 with `currency.exponent` as 2. Refer to [FAQ](#section/Menu/Is-the-menu-price-with-or-without-tax) to determine whether the pricing should be tax-inclusive or tax-exclusive. ") + photos: Optional[List[StrictStr]] = Field(default=None, description="An array string for the item’s image URL link. Only 1 image is supported. Refer to FAQs for more details about [images formats](#section/Menu/What-are-the-recommended-formats-for-an-item-image). ") + special_type: Optional[StrictStr] = Field(default=None, description="The item's special Tag. Refer to FAQs for more details about [specialType](#section/Menu/What's-specialType). ", alias="specialType") + taxable: Optional[StrictBool] = Field(default=None, description="**For Indonesia only.** This field allows the configuration for an item to be marked as tax applicable, and marked item would then be included in a commercial invoice to consumers as per the government's regulations. ") + barcode: Optional[Annotated[str, Field(strict=True, max_length=64)]] = Field(default=None, description="The barcode Number (GTIN). Max 64 allowed. GTIN must be 8, 12, 13, 14 numeric digits. ") + selling_time_id: Optional[StrictStr] = Field(default=None, description="The selling time's ID for the item. This value overrides the category's selling time if it is different. Empty value implies the category's selling time will be applied. ", alias="sellingTimeID") + max_stock: Optional[StrictInt] = Field(default=None, description="Available stocks under inventory for this item. Auto reduce when there is order placed for this item. Empty value implies no limit. > Note: It is necessary to set `maxStock` to 0 if the `availableStatus` of the item is `\"UNAVAILABLE\"`. Item will be set to `\"AVAILABLE\"` if `maxStock` > 0. ", alias="maxStock") + sequence: Optional[StrictInt] = Field(default=None, description="The sort or display order of the item within the menu.") + advanced_pricing: Optional[AdvancedPricing] = Field(default=None, alias="advancedPricing") + purchasability: Optional[Purchasability] = None + modifier_groups: Optional[List[ModifierGroup]] = Field(default=None, description="An array of the modifierGroup JSON objects. Max 30 allowed per item. Refer to [Modifier groups](#modifier-groups) for more information.", alias="modifierGroups") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "nameTranslation", "availableStatus", "description", "descriptionTranslation", "price", "photos", "specialType", "taxable", "barcode", "sellingTimeID", "maxStock", "sequence", "advancedPricing", "purchasability", "modifierGroups"] + + @field_validator('available_status') + def available_status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['AVAILABLE', 'UNAVAILABLE', 'HIDE', 'UNAVAILABLETODAY']): + raise ValueError("must be one of enum values ('AVAILABLE', 'UNAVAILABLE', 'HIDE', 'UNAVAILABLETODAY')") + return value + + @field_validator('special_type') + def special_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['alcohol', '']): + raise ValueError("must be one of enum values ('alcohol', '')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of advanced_pricing + if self.advanced_pricing: + _dict['advancedPricing'] = self.advanced_pricing.to_dict() + # override the default output from pydantic by calling `to_dict()` of purchasability + if self.purchasability: + _dict['purchasability'] = self.purchasability.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in modifier_groups (list) + _items = [] + if self.modifier_groups: + for _item_modifier_groups in self.modifier_groups: + if _item_modifier_groups: + _items.append(_item_modifier_groups.to_dict()) + _dict['modifierGroups'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "nameTranslation": obj.get("nameTranslation"), + "availableStatus": obj.get("availableStatus"), + "description": obj.get("description"), + "descriptionTranslation": obj.get("descriptionTranslation"), + "price": obj.get("price"), + "photos": obj.get("photos"), + "specialType": obj.get("specialType"), + "taxable": obj.get("taxable"), + "barcode": obj.get("barcode"), + "sellingTimeID": obj.get("sellingTimeID"), + "maxStock": obj.get("maxStock"), + "sequence": obj.get("sequence"), + "advancedPricing": AdvancedPricing.from_dict(obj["advancedPricing"]) if obj.get("advancedPricing") is not None else None, + "purchasability": Purchasability.from_dict(obj["purchasability"]) if obj.get("purchasability") is not None else None, + "modifierGroups": [ModifierGroup.from_dict(_item) for _item in obj["modifierGroups"]] if obj.get("modifierGroups") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_modifier.py b/grabfood/models/menu_modifier.py new file mode 100644 index 0000000..aa47429 --- /dev/null +++ b/grabfood/models/menu_modifier.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.advanced_pricing import AdvancedPricing +from typing import Optional, Set +from typing_extensions import Self + +class MenuModifier(BaseModel): + """ + MenuModifier + """ # noqa: E501 + id: Annotated[str, Field(strict=True, max_length=64)] = Field(description="The modifier's ID that is on the partner's system. This ID should be unique.") + name: Annotated[str, Field(strict=True, max_length=40)] = Field(description="The name of the modifier.") + name_translation: Optional[Dict[str, StrictStr]] = Field(default=None, description="Translation of the modifier name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation).", alias="nameTranslation") + available_status: StrictStr = Field(description="The status for the modifier. Refer to FAQs for more details about [availableStatus](#section/Menu/What-is-availableStatus).", alias="availableStatus") + price: Optional[StrictInt] = Field(default=None, description="The modifier's price in minor format. Refer to FAQs for more details about [tax](#section/Menu/Is-the-menu-price-with-or-without-tax).") + barcode: Optional[Annotated[str, Field(strict=True, max_length=64)]] = Field(default=None, description="The barcode Number (GTIN). GTIN must be 8, 12, 13, 14 numeric digits.") + sequence: Optional[StrictInt] = Field(default=None, description="The sort or display order of the modifier within the menu.") + advanced_pricing: Optional[AdvancedPricing] = Field(default=None, alias="advancedPricing") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "nameTranslation", "availableStatus", "price", "barcode", "sequence", "advancedPricing"] + + @field_validator('available_status') + def available_status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['AVAILABLE', 'UNAVAILABLE', 'UNAVAILABLETODAY', 'HIDE']): + raise ValueError("must be one of enum values ('AVAILABLE', 'UNAVAILABLE', 'UNAVAILABLETODAY', 'HIDE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuModifier from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of advanced_pricing + if self.advanced_pricing: + _dict['advancedPricing'] = self.advanced_pricing.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuModifier from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "nameTranslation": obj.get("nameTranslation"), + "availableStatus": obj.get("availableStatus"), + "price": obj.get("price"), + "barcode": obj.get("barcode"), + "sequence": obj.get("sequence"), + "advancedPricing": AdvancedPricing.from_dict(obj["advancedPricing"]) if obj.get("advancedPricing") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_section.py b/grabfood/models/menu_section.py new file mode 100644 index 0000000..cf5795c --- /dev/null +++ b/grabfood/models/menu_section.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from grabfood.models.menu_section_category import MenuSectionCategory +from grabfood.models.service_hours import ServiceHours +from typing import Optional, Set +from typing_extensions import Self + +class MenuSection(BaseModel): + """ + MenuSection + """ # noqa: E501 + id: Annotated[str, Field(strict=True, max_length=64)] = Field(description="The section's ID in the partner system. ") + name: Annotated[str, Field(strict=True, max_length=30)] = Field(description="The name of the section.") + service_hours: ServiceHours = Field(alias="serviceHours") + categories: List[MenuSectionCategory] = Field(description="An array of category JSON objects. Max 100 allowed per section. Refer to [Categories](#categories) for more information.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "serviceHours", "categories"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSection from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of service_hours + if self.service_hours: + _dict['serviceHours'] = self.service_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSection from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "serviceHours": ServiceHours.from_dict(obj["serviceHours"]) if obj.get("serviceHours") is not None else None, + "categories": [MenuSectionCategory.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_section_category.py b/grabfood/models/menu_section_category.py new file mode 100644 index 0000000..724dbe3 --- /dev/null +++ b/grabfood/models/menu_section_category.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.menu_section_category_item import MenuSectionCategoryItem +from typing import Optional, Set +from typing_extensions import Self + +class MenuSectionCategory(BaseModel): + """ + MenuSectionCategory + """ # noqa: E501 + id: Annotated[str, Field(strict=True, max_length=64)] = Field(description="The category's ID that is on the partner system. This ID should be unique with a min length of 1 and max of 64.") + name: Annotated[str, Field(strict=True, max_length=60)] = Field(description="The name of the category.") + name_translation: Optional[Dict[str, StrictStr]] = Field(default=None, description="Translation of the category name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation).", alias="nameTranslation") + available_status: StrictStr = Field(description="The status for the category. Refer to FAQs for more details about [availableStatus](#section/Menu/What-is-availableStatus).", alias="availableStatus") + items: List[MenuSectionCategoryItem] = Field(description="An array of item JSON objects. Max 300 allowed per category. Refer to [Items](#items) for more information.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "nameTranslation", "availableStatus", "items"] + + @field_validator('available_status') + def available_status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['AVAILABLE', 'UNAVAILABLE', 'HIDE']): + raise ValueError("must be one of enum values ('AVAILABLE', 'UNAVAILABLE', 'HIDE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSectionCategory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSectionCategory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "nameTranslation": obj.get("nameTranslation"), + "availableStatus": obj.get("availableStatus"), + "items": [MenuSectionCategoryItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_section_category_item.py b/grabfood/models/menu_section_category_item.py new file mode 100644 index 0000000..ca9408a --- /dev/null +++ b/grabfood/models/menu_section_category_item.py @@ -0,0 +1,164 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.advanced_pricing import AdvancedPricing +from grabfood.models.modifier_group import ModifierGroup +from grabfood.models.purchasability import Purchasability +from typing import Optional, Set +from typing_extensions import Self + +class MenuSectionCategoryItem(BaseModel): + """ + MenuSectionCategoryItem + """ # noqa: E501 + id: Annotated[str, Field(strict=True, max_length=64)] = Field(description="The item's ID in the partner system. ") + name: Annotated[str, Field(strict=True, max_length=80)] = Field(description="The name of the item.") + name_translation: Optional[Dict[str, StrictStr]] = Field(default=None, description="Translation of the item name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation).", alias="nameTranslation") + available_status: StrictStr = Field(description="The status for the item that is in the category. Refer to FAQs for more details about [availableStatus](#section/Menu/What-is-availableStatus). Note: In order to set an item as \"UNAVAILABLE\", it is required to update both the `availableStatus` and `maxStock` fields, whereby the `maxStock` value should be set to 0. ", alias="availableStatus") + description: Optional[Annotated[str, Field(strict=True, max_length=300)]] = Field(default=None, description="The description of the item. There is a custom length limit of 2000 for `VN`. ") + description_translation: Optional[Dict[str, StrictStr]] = Field(default=None, description="Translation of the item description. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation).", alias="descriptionTranslation") + price: StrictInt = Field(description="The item's price (excluding tax) in minor format. For example: 1900 means $19 with `currency.exponent` as 2. Refer to [FAQ](#section/Menu/Is-the-item-price-with-or-without-tax) for more details. ") + photos: Optional[List[StrictStr]] = Field(default=None, description="An array string for the item’s image URL links. Refer to FAQs for more details about [images](#section/Menu/What-are-the-recommended-formats-for-an-item-image). ") + special_type: Optional[StrictStr] = Field(default=None, description="The item's special Tag. Refer to FAQs for more details about [specialType](#section/Menu/What's-specialType). ", alias="specialType") + taxable: Optional[StrictBool] = Field(default=None, description="**For Indonesia only.** This field allows the configuration for an item to be marked as tax applicable, and marked item would then be included in a commercial invoice to consumers as per the government's regulations. ") + barcode: Optional[Annotated[str, Field(strict=True, max_length=64)]] = Field(default=None, description="The barcode Number (GTIN). Max 64 allowed. GTIN must be 8, 12, 13, 14 numeric digits. ") + max_stock: Optional[StrictInt] = Field(default=None, description="Available stocks under inventory for this item. Auto reduce when there is order placed for this item. Empty value implies no limit. Note: It is necessary to set `maxStock` to 0 if the `availableStatus` of the item is \"UNAVAILABLE\". Item will be set to \"AVAILABLE\" if `maxStock` > 0. ", alias="maxStock") + advanced_pricing: Optional[AdvancedPricing] = Field(default=None, alias="advancedPricing") + purchasability: Optional[Purchasability] = None + modifier_groups: Optional[List[ModifierGroup]] = Field(default=None, description="An array of the modifierGroup JSON objects. Max 30 allowed per item. Refer to [Modifier groups](#modifier-groups) for more information.", alias="modifierGroups") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "nameTranslation", "availableStatus", "description", "descriptionTranslation", "price", "photos", "specialType", "taxable", "barcode", "maxStock", "advancedPricing", "purchasability", "modifierGroups"] + + @field_validator('available_status') + def available_status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['AVAILABLE', 'UNAVAILABLE', 'HIDE', 'UNAVAILABLETODAY']): + raise ValueError("must be one of enum values ('AVAILABLE', 'UNAVAILABLE', 'HIDE', 'UNAVAILABLETODAY')") + return value + + @field_validator('special_type') + def special_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['alcohol', '']): + raise ValueError("must be one of enum values ('alcohol', '')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSectionCategoryItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of advanced_pricing + if self.advanced_pricing: + _dict['advancedPricing'] = self.advanced_pricing.to_dict() + # override the default output from pydantic by calling `to_dict()` of purchasability + if self.purchasability: + _dict['purchasability'] = self.purchasability.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in modifier_groups (list) + _items = [] + if self.modifier_groups: + for _item_modifier_groups in self.modifier_groups: + if _item_modifier_groups: + _items.append(_item_modifier_groups.to_dict()) + _dict['modifierGroups'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSectionCategoryItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "nameTranslation": obj.get("nameTranslation"), + "availableStatus": obj.get("availableStatus"), + "description": obj.get("description"), + "descriptionTranslation": obj.get("descriptionTranslation"), + "price": obj.get("price"), + "photos": obj.get("photos"), + "specialType": obj.get("specialType"), + "taxable": obj.get("taxable"), + "barcode": obj.get("barcode"), + "maxStock": obj.get("maxStock"), + "advancedPricing": AdvancedPricing.from_dict(obj["advancedPricing"]) if obj.get("advancedPricing") is not None else None, + "purchasability": Purchasability.from_dict(obj["purchasability"]) if obj.get("purchasability") is not None else None, + "modifierGroups": [ModifierGroup.from_dict(_item) for _item in obj["modifierGroups"]] if obj.get("modifierGroups") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_sync_fail.py b/grabfood/models/menu_sync_fail.py new file mode 100644 index 0000000..ab0a331 --- /dev/null +++ b/grabfood/models/menu_sync_fail.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.menu_sync_fail_category import MenuSyncFailCategory +from grabfood.models.menu_sync_fail_service_hours import MenuSyncFailServiceHours +from typing import Optional, Set +from typing_extensions import Self + +class MenuSyncFail(BaseModel): + """ + MenuSyncFail + """ # noqa: E501 + id: Optional[StrictStr] = None + errors: Optional[List[StrictStr]] = Field(default=None, description="An array of strings of error message.") + service_hours: Optional[MenuSyncFailServiceHours] = Field(default=None, alias="serviceHours") + categories: Optional[List[MenuSyncFailCategory]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "errors", "serviceHours", "categories"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSyncFail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of service_hours + if self.service_hours: + _dict['serviceHours'] = self.service_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSyncFail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "errors": obj.get("errors"), + "serviceHours": MenuSyncFailServiceHours.from_dict(obj["serviceHours"]) if obj.get("serviceHours") is not None else None, + "categories": [MenuSyncFailCategory.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_sync_fail_category.py b/grabfood/models/menu_sync_fail_category.py new file mode 100644 index 0000000..afa4bfb --- /dev/null +++ b/grabfood/models/menu_sync_fail_category.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.menu_sync_fail_item import MenuSyncFailItem +from typing import Optional, Set +from typing_extensions import Self + +class MenuSyncFailCategory(BaseModel): + """ + MenuSyncFailCategory + """ # noqa: E501 + id: Optional[Annotated[str, Field(strict=True, max_length=64)]] = Field(default=None, description="The category's ID that is on the partner system. This ID should be unique with a min length of 1 and max of 64.") + errors: Optional[List[StrictStr]] = Field(default=None, description="An array of strings of error message.") + items: Optional[List[MenuSyncFailItem]] = Field(default=None, description="An array of item JSON objects. Max 300 allowed per category. Refer to [Items](#items) for more information.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "errors", "items"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSyncFailCategory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSyncFailCategory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "errors": obj.get("errors"), + "items": [MenuSyncFailItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_sync_fail_item.py b/grabfood/models/menu_sync_fail_item.py new file mode 100644 index 0000000..194ff4b --- /dev/null +++ b/grabfood/models/menu_sync_fail_item.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.menu_sync_fail_modifier_group import MenuSyncFailModifierGroup +from typing import Optional, Set +from typing_extensions import Self + +class MenuSyncFailItem(BaseModel): + """ + MenuSyncFailItem + """ # noqa: E501 + id: Optional[Annotated[str, Field(strict=True, max_length=64)]] = Field(default=None, description="The item's ID in the partner system. ") + errors: Optional[List[StrictStr]] = Field(default=None, description="An array of strings of error message.") + modifier_groups: Optional[List[MenuSyncFailModifierGroup]] = Field(default=None, alias="modifierGroups") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "errors", "modifierGroups"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSyncFailItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in modifier_groups (list) + _items = [] + if self.modifier_groups: + for _item_modifier_groups in self.modifier_groups: + if _item_modifier_groups: + _items.append(_item_modifier_groups.to_dict()) + _dict['modifierGroups'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSyncFailItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "errors": obj.get("errors"), + "modifierGroups": [MenuSyncFailModifierGroup.from_dict(_item) for _item in obj["modifierGroups"]] if obj.get("modifierGroups") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_sync_fail_modifier.py b/grabfood/models/menu_sync_fail_modifier.py new file mode 100644 index 0000000..c185ae0 --- /dev/null +++ b/grabfood/models/menu_sync_fail_modifier.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class MenuSyncFailModifier(BaseModel): + """ + MenuSyncFailModifier + """ # noqa: E501 + id: Optional[StrictStr] = None + errors: Optional[List[StrictStr]] = Field(default=None, description="An array of strings of error message.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSyncFailModifier from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSyncFailModifier from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "errors": obj.get("errors") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_sync_fail_modifier_group.py b/grabfood/models/menu_sync_fail_modifier_group.py new file mode 100644 index 0000000..b4b6c5c --- /dev/null +++ b/grabfood/models/menu_sync_fail_modifier_group.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.menu_sync_fail_modifier import MenuSyncFailModifier +from typing import Optional, Set +from typing_extensions import Self + +class MenuSyncFailModifierGroup(BaseModel): + """ + MenuSyncFailModifierGroup + """ # noqa: E501 + id: Optional[StrictStr] = None + errors: Optional[List[StrictStr]] = Field(default=None, description="An array of strings of error message.") + modifiers: Optional[List[MenuSyncFailModifier]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "errors", "modifiers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSyncFailModifierGroup from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in modifiers (list) + _items = [] + if self.modifiers: + for _item_modifiers in self.modifiers: + if _item_modifiers: + _items.append(_item_modifiers.to_dict()) + _dict['modifiers'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSyncFailModifierGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "errors": obj.get("errors"), + "modifiers": [MenuSyncFailModifier.from_dict(_item) for _item in obj["modifiers"]] if obj.get("modifiers") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_sync_fail_service_hours.py b/grabfood/models/menu_sync_fail_service_hours.py new file mode 100644 index 0000000..c10d93d --- /dev/null +++ b/grabfood/models/menu_sync_fail_service_hours.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class MenuSyncFailServiceHours(BaseModel): + """ + MenuSyncFailServiceHours + """ # noqa: E501 + errors: Optional[List[StrictStr]] = Field(default=None, description="An array of strings of error message.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSyncFailServiceHours from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSyncFailServiceHours from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "errors": obj.get("errors") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_sync_response.py b/grabfood/models/menu_sync_response.py new file mode 100644 index 0000000..9cde01f --- /dev/null +++ b/grabfood/models/menu_sync_response.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.menu_sync_fail import MenuSyncFail +from typing import Optional, Set +from typing_extensions import Self + +class MenuSyncResponse(BaseModel): + """ + + """ # noqa: E501 + created_time: datetime = Field(description="The Unix time the specified menu was created in GrabFood's database.", alias="createdTime") + updated_time: datetime = Field(description="The Unix time the specified menu was created in GrabFood's database.", alias="updatedTime") + code: StrictStr = Field(description="The status code for this request. See [Menu sync response statuses](#section/Menu-sync-response-statuses) for more information.") + errors: Optional[List[StrictStr]] = Field(default=None, description="An array of strings of error message.") + sections: Optional[List[MenuSyncFail]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["createdTime", "updatedTime", "code", "errors", "sections"] + + @field_validator('code') + def code_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Success', 'PartialSuccess', 'InQueuing']): + raise ValueError("must be one of enum values ('Success', 'PartialSuccess', 'InQueuing')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSyncResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in sections (list) + _items = [] + if self.sections: + for _item_sections in self.sections: + if _item_sections: + _items.append(_item_sections.to_dict()) + _dict['sections'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if errors (nullable) is None + # and model_fields_set contains the field + if self.errors is None and "errors" in self.model_fields_set: + _dict['errors'] = None + + # set to None if sections (nullable) is None + # and model_fields_set contains the field + if self.sections is None and "sections" in self.model_fields_set: + _dict['sections'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSyncResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "createdTime": obj.get("createdTime"), + "updatedTime": obj.get("updatedTime"), + "code": obj.get("code"), + "errors": obj.get("errors"), + "sections": [MenuSyncFail.from_dict(_item) for _item in obj["sections"]] if obj.get("sections") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/menu_sync_webhook_request.py b/grabfood/models/menu_sync_webhook_request.py new file mode 100644 index 0000000..3d0c02d --- /dev/null +++ b/grabfood/models/menu_sync_webhook_request.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class MenuSyncWebhookRequest(BaseModel): + """ + This request pushes the state of a menu sync operation. + """ # noqa: E501 + request_id: Optional[StrictStr] = Field(default=None, description="An universally unique identifier (UUID) string. Used to uniquely identify a webhook request. Partners should use this value to distinguish between different webhook requests. If two requests contain the same requestID, only the first request should be considered and later requests **must** be ignored or discarded. ", alias="requestID") + merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + partner_merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is on the partner's database.", alias="partnerMerchantID") + job_id: Optional[StrictStr] = Field(default=None, description="An UUID string. Uniquely identifies a menu sync job. This can be found from the [Menu Update Notification](#tag/update-menu-noti) API response header. ", alias="jobID") + updated_at: Optional[StrictStr] = Field(default=None, description="Indicates the time of menu sync status change. This is based on ISO_8601/RFC3339. For example: `2022-07-29T15:55:59Z`. ", alias="updatedAt") + status: Optional[StrictStr] = Field(default=None, description="Indicates the state of the menu sync job.") + errors: Optional[List[StrictStr]] = Field(default=None, description="A string array of errors that occurred during processing. This array is empty if the status is not `FAILED`.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["requestID", "merchantID", "partnerMerchantID", "jobID", "updatedAt", "status", "errors"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['QUEUEING', 'PROCESSING', 'SUCCESS', 'FAILED']): + raise ValueError("must be one of enum values ('QUEUEING', 'PROCESSING', 'SUCCESS', 'FAILED')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MenuSyncWebhookRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MenuSyncWebhookRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "requestID": obj.get("requestID"), + "merchantID": obj.get("merchantID"), + "partnerMerchantID": obj.get("partnerMerchantID"), + "jobID": obj.get("jobID"), + "updatedAt": obj.get("updatedAt"), + "status": obj.get("status"), + "errors": obj.get("errors") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/modifier_group.py b/grabfood/models/modifier_group.py new file mode 100644 index 0000000..7d349fb --- /dev/null +++ b/grabfood/models/modifier_group.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.menu_modifier import MenuModifier +from typing import Optional, Set +from typing_extensions import Self + +class ModifierGroup(BaseModel): + """ + ModifierGroup + """ # noqa: E501 + id: Annotated[str, Field(strict=True, max_length=64)] = Field(description="The modifier group's ID that is on the partner system. This ID should be unique.") + name: Annotated[str, Field(strict=True, max_length=50)] = Field(description="The name of the modifier group.") + name_translation: Optional[Dict[str, StrictStr]] = Field(default=None, description="Translation of the modifier group name. Only support up to 1 translated language. Refer [Menu Translation](#section/Menu-Translation).", alias="nameTranslation") + available_status: StrictStr = Field(description="The status for the modifier group. > The item may be marked as `\"UNAVAILABLE\"` if no available modifier to be selected within the required modifier group where `\"selectionRangeMin\": 1`. ", alias="availableStatus") + selection_range_min: Optional[StrictInt] = Field(default=None, description="The minimum quantity of the modifiers to be selected. Refer to FAQs for more details about [selection range](#section/Menu/What-does-the-selection-range-do).", alias="selectionRangeMin") + selection_range_max: StrictInt = Field(description="The maximum quantity of the modifiers to be selected. Refer to FAQs for more details about [selection range](#section/Menu/What-does-the-selection-range-do).", alias="selectionRangeMax") + sequence: Optional[StrictInt] = Field(default=None, description="The sort or display order of the modifier group within the menu.") + modifiers: Optional[List[MenuModifier]] = Field(default=None, description="An array of modifier JSON objects. Max 100 per modifierGroup. Refer to [Modifiers](#modifiers) for more information.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "nameTranslation", "availableStatus", "selectionRangeMin", "selectionRangeMax", "sequence", "modifiers"] + + @field_validator('available_status') + def available_status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['AVAILABLE', 'UNAVAILABLE', 'UNAVAILABLETODAY', 'HIDE']): + raise ValueError("must be one of enum values ('AVAILABLE', 'UNAVAILABLE', 'UNAVAILABLETODAY', 'HIDE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ModifierGroup from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in modifiers (list) + _items = [] + if self.modifiers: + for _item_modifiers in self.modifiers: + if _item_modifiers: + _items.append(_item_modifiers.to_dict()) + _dict['modifiers'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ModifierGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "nameTranslation": obj.get("nameTranslation"), + "availableStatus": obj.get("availableStatus"), + "selectionRangeMin": obj.get("selectionRangeMin"), + "selectionRangeMax": obj.get("selectionRangeMax"), + "sequence": obj.get("sequence"), + "modifiers": [MenuModifier.from_dict(_item) for _item in obj["modifiers"]] if obj.get("modifiers") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/new_order_time_request.py b/grabfood/models/new_order_time_request.py new file mode 100644 index 0000000..5a3caba --- /dev/null +++ b/grabfood/models/new_order_time_request.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class NewOrderTimeRequest(BaseModel): + """ + This request updates an order with a new ready time on GrabFood. + """ # noqa: E501 + order_id: StrictStr = Field(description="The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="orderID") + new_order_ready_time: datetime = Field(description="The new order ready time for this order, based on ISO_8601/RFC3339.", alias="newOrderReadyTime") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["orderID", "newOrderReadyTime"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of NewOrderTimeRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of NewOrderTimeRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "orderID": obj.get("orderID"), + "newOrderReadyTime": obj.get("newOrderReadyTime") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/notify_membership_webview_request.py b/grabfood/models/notify_membership_webview_request.py new file mode 100644 index 0000000..07cb647 --- /dev/null +++ b/grabfood/models/notify_membership_webview_request.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class NotifyMembershipWebviewRequest(BaseModel): + """ + This request submits membership registration request to partner. + """ # noqa: E501 + member_id: Optional[StrictStr] = Field(default=None, description="The unique member ID on the partner's database.", alias="memberID") + grab_id: Optional[StrictStr] = Field(default=None, description="The id used to identify an unique grab user.", alias="grabID") + merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + action: Optional[StrictStr] = Field(default=None, description="Action completed in partner's webview.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["memberID", "grabID", "merchantID", "action"] + + @field_validator('action') + def action_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LINK', 'REGISTER', 'UNLINK']): + raise ValueError("must be one of enum values ('LINK', 'REGISTER', 'UNLINK')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of NotifyMembershipWebviewRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of NotifyMembershipWebviewRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "memberID": obj.get("memberID"), + "grabID": obj.get("grabID"), + "merchantID": obj.get("merchantID"), + "action": obj.get("action") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/open_period.py b/grabfood/models/open_period.py new file mode 100644 index 0000000..370d5b9 --- /dev/null +++ b/grabfood/models/open_period.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class OpenPeriod(BaseModel): + """ + OpenPeriod + """ # noqa: E501 + start_time: StrictStr = Field(description="The open start time in 24h format. Local time format is expected.", alias="startTime") + end_time: StrictStr = Field(description="The open end time in 24h format. Local time format is expected.", alias="endTime") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["startTime", "endTime"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OpenPeriod from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OpenPeriod from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "startTime": obj.get("startTime"), + "endTime": obj.get("endTime") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order.py b/grabfood/models/order.py new file mode 100644 index 0000000..ec23317 --- /dev/null +++ b/grabfood/models/order.py @@ -0,0 +1,218 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.currency import Currency +from grabfood.models.dine_in import DineIn +from grabfood.models.order_campaign import OrderCampaign +from grabfood.models.order_feature_flags import OrderFeatureFlags +from grabfood.models.order_item import OrderItem +from grabfood.models.order_price import OrderPrice +from grabfood.models.order_promo import OrderPromo +from grabfood.models.order_ready_estimation import OrderReadyEstimation +from grabfood.models.receiver import Receiver +from typing import Optional, Set +from typing_extensions import Self + +class Order(BaseModel): + """ + A JSON object containing the order information. + """ # noqa: E501 + order_id: StrictStr = Field(description="The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="orderID") + short_order_number: StrictStr = Field(description="The GrabFood short order number. This is unique for each merchant per day. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="shortOrderNumber") + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + partner_merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is on the partner's database.", alias="partnerMerchantID") + payment_type: StrictStr = Field(description="The payment method used. Refer to FAQs for more details about [paymentType](#section/Order/Does-the-paymentType-affect-partners).", alias="paymentType") + cutlery: StrictBool = Field(description="The boolean value to indicate whether cutlery are needed or not. Refer to FAQs for more details about [cutlery](#section/Order/What-do-the-true-or-false-values-mean-for-cutlery).") + order_time: StrictStr = Field(description="The UTC time that a consumer places the order, based on ISO_8601/RFC3339.", alias="orderTime") + submit_time: Optional[datetime] = Field(default=None, description="The order submit time, based on ISO_8601/RFC3339. `null` in Submit Order payload. Only present in the [List Orders](#tag/list-order) response.", alias="submitTime") + complete_time: Optional[datetime] = Field(default=None, description="The order complete time, based on ISO_8601/RFC3339. `null` in Submit Order payload. Only present in the [List Orders](#tag/list-order) response.", alias="completeTime") + scheduled_time: Optional[StrictStr] = Field(default=None, description="The order scheduled time, based on ISO_8601/RFC3339. Empty for non-scheduled orders.", alias="scheduledTime") + order_state: Optional[StrictStr] = Field(default=None, description="The state of the order. Empty in Submit Order payload. Only present in the [List Orders](#tag/list-order) response. Refer to [Order States](#section/Order-states).", alias="orderState") + currency: Currency + feature_flags: OrderFeatureFlags = Field(alias="featureFlags") + items: List[OrderItem] = Field(description="The ordered items in an array of JSON Object. ") + campaigns: Optional[List[OrderCampaign]] = Field(default=None, description="The campaigns that are applicable for the order. `null` when there is no campaign applied. Only campaigns that are funded by merchants will be sent. ") + promos: Optional[List[OrderPromo]] = Field(default=None, description="An array of promotion objects. `null` when there is no promo code applied. Only promotions that are funded by merchants will be sent.") + price: OrderPrice + dine_in: Optional[DineIn] = Field(default=None, alias="dineIn") + receiver: Optional[Receiver] = None + order_ready_estimation: Optional[OrderReadyEstimation] = Field(default=None, alias="orderReadyEstimation") + membership_id: Optional[StrictStr] = Field(default=None, description="Membership ID for loyalty project. Only present for loyalty program partners. Empty if not applicable.", alias="membershipID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["orderID", "shortOrderNumber", "merchantID", "partnerMerchantID", "paymentType", "cutlery", "orderTime", "submitTime", "completeTime", "scheduledTime", "orderState", "currency", "featureFlags", "items", "campaigns", "promos", "price", "dineIn", "receiver", "orderReadyEstimation", "membershipID"] + + @field_validator('payment_type') + def payment_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['CASH', 'CASHLESS']): + raise ValueError("must be one of enum values ('CASH', 'CASHLESS')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Order from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of currency + if self.currency: + _dict['currency'] = self.currency.to_dict() + # override the default output from pydantic by calling `to_dict()` of feature_flags + if self.feature_flags: + _dict['featureFlags'] = self.feature_flags.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in campaigns (list) + _items = [] + if self.campaigns: + for _item_campaigns in self.campaigns: + if _item_campaigns: + _items.append(_item_campaigns.to_dict()) + _dict['campaigns'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in promos (list) + _items = [] + if self.promos: + for _item_promos in self.promos: + if _item_promos: + _items.append(_item_promos.to_dict()) + _dict['promos'] = _items + # override the default output from pydantic by calling `to_dict()` of price + if self.price: + _dict['price'] = self.price.to_dict() + # override the default output from pydantic by calling `to_dict()` of dine_in + if self.dine_in: + _dict['dineIn'] = self.dine_in.to_dict() + # override the default output from pydantic by calling `to_dict()` of receiver + if self.receiver: + _dict['receiver'] = self.receiver.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_ready_estimation + if self.order_ready_estimation: + _dict['orderReadyEstimation'] = self.order_ready_estimation.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if campaigns (nullable) is None + # and model_fields_set contains the field + if self.campaigns is None and "campaigns" in self.model_fields_set: + _dict['campaigns'] = None + + # set to None if promos (nullable) is None + # and model_fields_set contains the field + if self.promos is None and "promos" in self.model_fields_set: + _dict['promos'] = None + + # set to None if dine_in (nullable) is None + # and model_fields_set contains the field + if self.dine_in is None and "dine_in" in self.model_fields_set: + _dict['dineIn'] = None + + # set to None if receiver (nullable) is None + # and model_fields_set contains the field + if self.receiver is None and "receiver" in self.model_fields_set: + _dict['receiver'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Order from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "orderID": obj.get("orderID"), + "shortOrderNumber": obj.get("shortOrderNumber"), + "merchantID": obj.get("merchantID"), + "partnerMerchantID": obj.get("partnerMerchantID"), + "paymentType": obj.get("paymentType"), + "cutlery": obj.get("cutlery"), + "orderTime": obj.get("orderTime"), + "submitTime": obj.get("submitTime"), + "completeTime": obj.get("completeTime"), + "scheduledTime": obj.get("scheduledTime"), + "orderState": obj.get("orderState"), + "currency": Currency.from_dict(obj["currency"]) if obj.get("currency") is not None else None, + "featureFlags": OrderFeatureFlags.from_dict(obj["featureFlags"]) if obj.get("featureFlags") is not None else None, + "items": [OrderItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "campaigns": [OrderCampaign.from_dict(_item) for _item in obj["campaigns"]] if obj.get("campaigns") is not None else None, + "promos": [OrderPromo.from_dict(_item) for _item in obj["promos"]] if obj.get("promos") is not None else None, + "price": OrderPrice.from_dict(obj["price"]) if obj.get("price") is not None else None, + "dineIn": DineIn.from_dict(obj["dineIn"]) if obj.get("dineIn") is not None else None, + "receiver": Receiver.from_dict(obj["receiver"]) if obj.get("receiver") is not None else None, + "orderReadyEstimation": OrderReadyEstimation.from_dict(obj["orderReadyEstimation"]) if obj.get("orderReadyEstimation") is not None else None, + "membershipID": obj.get("membershipID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order_campaign.py b/grabfood/models/order_campaign.py new file mode 100644 index 0000000..50ea908 --- /dev/null +++ b/grabfood/models/order_campaign.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.order_free_item import OrderFreeItem +from typing import Optional, Set +from typing_extensions import Self + +class OrderCampaign(BaseModel): + """ + OrderCampaign + """ # noqa: E501 + id: Optional[Annotated[str, Field(strict=True, max_length=64)]] = Field(default=None, description="The campaign's ID returned by GrabFood upon campaign creation.") + name: Optional[Annotated[str, Field(strict=True, max_length=60)]] = Field(default=None, description="The name of the campaign. This campaign name has been automatically generated by Grab for display in the customer app.") + campaign_name_for_mex: Optional[StrictStr] = Field(default=None, description="The campaign name provided by the merchant in [Create Campaign](#tag/create-campaign). Whitelist required, reach out to your integration manager.", alias="campaignNameForMex") + level: Optional[StrictStr] = Field(default=None, description="The campaign level.") + type: Optional[StrictStr] = Field(default=None, description="The type of campaign.") + usage_count: Optional[StrictInt] = Field(default=None, description="The redemption count of same campaign in this order.", alias="usageCount") + mex_funded_ratio: Optional[StrictInt] = Field(default=None, description="The ratio funded by the merchant in percentage.", alias="mexFundedRatio") + deducted_amount: Optional[StrictInt] = Field(default=None, description="The total discount amount in minor unit format applied to the order based on the campaign's usage count. The amount is rounded to the nearest value for `VND`, `IDR`, and `THB`, as decimals are not supported. ``` deductedAmount = Item price(tax inclusive) * 20% discount | 2375*0.2=475 ", alias="deductedAmount") + deducted_part: Optional[StrictStr] = Field(default=None, description="The part that the campaign is applied.", alias="deductedPart") + applied_item_ids: Optional[List[StrictStr]] = Field(default=None, description="An array of item IDs that get discount under this campaign. `null` if no item applied in this campaign.", alias="appliedItemIDs") + free_item: Optional[OrderFreeItem] = Field(default=None, alias="freeItem") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "campaignNameForMex", "level", "type", "usageCount", "mexFundedRatio", "deductedAmount", "deductedPart", "appliedItemIDs", "freeItem"] + + @field_validator('level') + def level_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['item', 'category', 'order', 'delivery_fee', 'bundle']): + raise ValueError("must be one of enum values ('item', 'category', 'order', 'delivery_fee', 'bundle')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['percentage', 'net', 'delivery', 'freeItem', 'bundleSameNet', 'bundleSamePercentage', 'bundleSameFixPrice']): + raise ValueError("must be one of enum values ('percentage', 'net', 'delivery', 'freeItem', 'bundleSameNet', 'bundleSamePercentage', 'bundleSameFixPrice')") + return value + + @field_validator('deducted_part') + def deducted_part_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['basket_amount', 'delivery_fee']): + raise ValueError("must be one of enum values ('basket_amount', 'delivery_fee')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderCampaign from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of free_item + if self.free_item: + _dict['freeItem'] = self.free_item.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if applied_item_ids (nullable) is None + # and model_fields_set contains the field + if self.applied_item_ids is None and "applied_item_ids" in self.model_fields_set: + _dict['appliedItemIDs'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderCampaign from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "campaignNameForMex": obj.get("campaignNameForMex"), + "level": obj.get("level"), + "type": obj.get("type"), + "usageCount": obj.get("usageCount"), + "mexFundedRatio": obj.get("mexFundedRatio"), + "deductedAmount": obj.get("deductedAmount"), + "deductedPart": obj.get("deductedPart"), + "appliedItemIDs": obj.get("appliedItemIDs"), + "freeItem": OrderFreeItem.from_dict(obj["freeItem"]) if obj.get("freeItem") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order_delivery_request.py b/grabfood/models/order_delivery_request.py new file mode 100644 index 0000000..c8a6d14 --- /dev/null +++ b/grabfood/models/order_delivery_request.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class OrderDeliveryRequest(BaseModel): + """ + This request marks an order as delivered on GrabFood. + """ # noqa: E501 + order_id: StrictStr = Field(description="The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="orderID") + from_state: StrictStr = Field(description="Specify the order's initial state.", alias="fromState") + to_state: StrictStr = Field(description="Specify the order's new state.", alias="toState") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["orderID", "fromState", "toState"] + + @field_validator('from_state') + def from_state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Accepted', 'FindDriver', 'Collected']): + raise ValueError("must be one of enum values ('Accepted', 'FindDriver', 'Collected')") + return value + + @field_validator('to_state') + def to_state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['FindDriver', 'Collected', 'Delivered']): + raise ValueError("must be one of enum values ('FindDriver', 'Collected', 'Delivered')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderDeliveryRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderDeliveryRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "orderID": obj.get("orderID"), + "fromState": obj.get("fromState"), + "toState": obj.get("toState") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order_feature_flags.py b/grabfood/models/order_feature_flags.py new file mode 100644 index 0000000..f185d64 --- /dev/null +++ b/grabfood/models/order_feature_flags.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class OrderFeatureFlags(BaseModel): + """ + The featureFlag JSON object containing an order's feature related information. + """ # noqa: E501 + order_accepted_type: StrictStr = Field(description="The acceptance type for the order. Refer to FAQs for more details about [orderAcceptedType](#section/Order/How-do-I-identify-if-a-particular-order-is-auto-or-manual-acceptance). ", alias="orderAcceptedType") + order_type: StrictStr = Field(description="The type of order. ", alias="orderType") + is_mex_edit_order: Optional[StrictBool] = Field(default=None, description="A boolean value that indicates if the order is edited. ", alias="isMexEditOrder") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["orderAcceptedType", "orderType", "isMexEditOrder"] + + @field_validator('order_accepted_type') + def order_accepted_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['AUTO', 'MANUAL']): + raise ValueError("must be one of enum values ('AUTO', 'MANUAL')") + return value + + @field_validator('order_type') + def order_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['TakeAway', 'DeliveredByGrab', 'DeliveredByRestaurant', 'DineIn']): + raise ValueError("must be one of enum values ('TakeAway', 'DeliveredByGrab', 'DeliveredByRestaurant', 'DineIn')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderFeatureFlags from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderFeatureFlags from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "orderAcceptedType": obj.get("orderAcceptedType"), + "orderType": obj.get("orderType"), + "isMexEditOrder": obj.get("isMexEditOrder") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order_free_item.py b/grabfood/models/order_free_item.py new file mode 100644 index 0000000..95aefa0 --- /dev/null +++ b/grabfood/models/order_free_item.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class OrderFreeItem(BaseModel): + """ + Free item information for `freeItem` campaign. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The free item's externalID in the partner system. Empty if not applicable.") + name: Optional[StrictStr] = Field(default=None, description="The name of the free item. Empty if not applicable. ") + quantity: Optional[StrictInt] = Field(default=None, description="The item's quantity. Maximum is **1**.") + price: Optional[StrictInt] = Field(default=None, description="The item's price in minor unit format.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "quantity", "price"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderFreeItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderFreeItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "quantity": obj.get("quantity"), + "price": obj.get("price") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order_item.py b/grabfood/models/order_item.py new file mode 100644 index 0000000..d2318ba --- /dev/null +++ b/grabfood/models/order_item.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.order_item_modifier import OrderItemModifier +from grabfood.models.out_of_stock_instruction import OutOfStockInstruction +from typing import Optional, Set +from typing_extensions import Self + +class OrderItem(BaseModel): + """ + OrderItem + """ # noqa: E501 + id: StrictStr = Field(description="The item's externalID in the partner system. ") + grab_item_id: StrictStr = Field(description="The item's ID in Grab system. Partner can use this field in the `EditOrder` endpoint.", alias="grabItemID") + quantity: StrictInt = Field(description="The number of the item ordered.") + price: StrictInt = Field(description="The price for a single item along with its associated modifiers in minor unit and tax-inclusive. ``` price = Item price(tax inclusive) + Modifier price(tax inclusive) | (2241*1.06)+(165*1.06)=2550 ") + tax: Optional[StrictInt] = Field(default=None, description="Tax in minor format for a single item along with its associated modifiers. `0` if tax configuration is absent. Refer to FAQs for more details about [tax](#section/Order/How-is-tax-calculated). ``` tax = Item tax + Modifier tax | (2241*0.06)+(165*0.06)=144 ") + specifications: Optional[Annotated[str, Field(strict=True, max_length=300)]] = Field(default=None, description="An extra note for the merchant. Empty if no note from consumer. ") + out_of_stock_instruction: Optional[OutOfStockInstruction] = Field(default=None, alias="outOfStockInstruction") + modifiers: Optional[List[OrderItemModifier]] = Field(default=None, description="An array of JSON objects modifiers.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "grabItemID", "quantity", "price", "tax", "specifications", "outOfStockInstruction", "modifiers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of out_of_stock_instruction + if self.out_of_stock_instruction: + _dict['outOfStockInstruction'] = self.out_of_stock_instruction.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in modifiers (list) + _items = [] + if self.modifiers: + for _item_modifiers in self.modifiers: + if _item_modifiers: + _items.append(_item_modifiers.to_dict()) + _dict['modifiers'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if out_of_stock_instruction (nullable) is None + # and model_fields_set contains the field + if self.out_of_stock_instruction is None and "out_of_stock_instruction" in self.model_fields_set: + _dict['outOfStockInstruction'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "grabItemID": obj.get("grabItemID"), + "quantity": obj.get("quantity"), + "price": obj.get("price"), + "tax": obj.get("tax"), + "specifications": obj.get("specifications"), + "outOfStockInstruction": OutOfStockInstruction.from_dict(obj["outOfStockInstruction"]) if obj.get("outOfStockInstruction") is not None else None, + "modifiers": [OrderItemModifier.from_dict(_item) for _item in obj["modifiers"]] if obj.get("modifiers") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order_item_modifier.py b/grabfood/models/order_item_modifier.py new file mode 100644 index 0000000..bd7cb16 --- /dev/null +++ b/grabfood/models/order_item_modifier.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class OrderItemModifier(BaseModel): + """ + OrderItemModifier + """ # noqa: E501 + id: Optional[Annotated[str, Field(strict=True, max_length=64)]] = Field(default=None, description="The modifier's ID that is on the partner's system.") + price: Optional[StrictInt] = Field(default=None, description="The modifier's price (tax-inclusive) in minor format. ``` price = round(165 * (1 + 0.06)) = 175 ") + tax: Optional[StrictInt] = Field(default=None, description="Tax in minor format for 1 modifier. Refer to FAQs for more details about [tax](#section/Order/How-is-tax-calculated). ``` tax = 165*0.06=10 ") + quantity: Optional[StrictInt] = Field(default=None, description="The number of modifiers present. The value is always 1.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "price", "tax", "quantity"] + + @field_validator('quantity') + def quantity_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set([1]): + raise ValueError("must be one of enum values (1)") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderItemModifier from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderItemModifier from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "price": obj.get("price"), + "tax": obj.get("tax"), + "quantity": obj.get("quantity") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order_price.py b/grabfood/models/order_price.py new file mode 100644 index 0000000..3d87f83 --- /dev/null +++ b/grabfood/models/order_price.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class OrderPrice(BaseModel): + """ + A JSON object containing order's price in the minor unit format. + """ # noqa: E501 + subtotal: StrictInt = Field(description="Total item and modifier price (tax-inclusive) in the minor unit. ``` subtotal = Sum of all (item price * quantity) | 2550*1=2550 ") + tax: Optional[StrictInt] = Field(default=None, description="GrabFood's tax in the minor unit. Refer to FAQs for more details about [tax](#section/Order/How-is-tax-calculated). ``` tax = (subtotal + merchantChargeFee - merchantFundPromo) * Tax / (1+Tax) | (2550-475)*0.06/1.06=117 ") + merchant_charge_fee: Optional[StrictInt] = Field(default=None, description="Any additional fee charged by merchant (tax-inclusive), which is 100% paid out to the merchant. Eg. Takeaway, packaging costs, dine-in charge. ", alias="merchantChargeFee") + grab_fund_promo: Optional[StrictInt] = Field(default=None, description="GrabFood's promo fund in the minor unit. Calculated based on funded ratio. Only present when `paymentType:CASH` or `orderType:DeliveredByRestaurant`. Otherwise, it will be set to `0`.", alias="grabFundPromo") + merchant_fund_promo: Optional[StrictInt] = Field(default=None, description="The merchant's promo fund in the minor unit. Calculated based on funded ratio.", alias="merchantFundPromo") + basket_promo: Optional[StrictInt] = Field(default=None, description="The total amount promo applied to the basket items only (item level/order level) in the minor unit, excluding delivery fee. Only present when `paymentType: CASH` or `orderType: DeliveredByRestaurant`. Otherwise, it will be set to `0`. ``` basketPromo = (grabFundPromo + merchantFundPromo) | 300 + 475 = 775 ", alias="basketPromo") + delivery_fee: Optional[StrictInt] = Field(default=None, description="The delivery fee in the minor unit. Only present when `paymentType:CASH` or `orderType:DeliveredByRestaurant`. Otherwise, it will be set to `0`.", alias="deliveryFee") + small_order_fee: Optional[StrictInt] = Field(default=None, description="The fee charged by GrabFood for order that does not meet a certain minimum order value. Only present when `paymentType:CASH` and `orderType:DeliveredByRestaurant`.", alias="smallOrderFee") + eater_payment: Optional[StrictInt] = Field(default=None, description="The total amount paid by the consumer in the minor unit, excluding some additional fees charged by GrabFood. Only present when `paymentType:CASH` or `orderType:DeliveredByRestaurant`. Otherwise, it will be set to `0`. ``` eaterPayment = (subtotal + merchantChargeFee + deliveryFee) - (sum of all promo) | (2550+400)-775=2175 ", alias="eaterPayment") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["subtotal", "tax", "merchantChargeFee", "grabFundPromo", "merchantFundPromo", "basketPromo", "deliveryFee", "smallOrderFee", "eaterPayment"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderPrice from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderPrice from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "subtotal": obj.get("subtotal"), + "tax": obj.get("tax"), + "merchantChargeFee": obj.get("merchantChargeFee"), + "grabFundPromo": obj.get("grabFundPromo"), + "merchantFundPromo": obj.get("merchantFundPromo"), + "basketPromo": obj.get("basketPromo"), + "deliveryFee": obj.get("deliveryFee"), + "smallOrderFee": obj.get("smallOrderFee"), + "eaterPayment": obj.get("eaterPayment") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order_promo.py b/grabfood/models/order_promo.py new file mode 100644 index 0000000..fba8a5d --- /dev/null +++ b/grabfood/models/order_promo.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class OrderPromo(BaseModel): + """ + OrderPromo + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Promo code applied in the order.") + description: Optional[StrictStr] = Field(default=None, description="Promo description.") + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion.") + promo_amount: Optional[StrictInt] = Field(default=None, description="Promo amount applied in the order, in local currency. This amount is rounded into whole number.", alias="promoAmount") + mex_funded_ratio: Optional[StrictInt] = Field(default=None, description="The merchant's funded ratio of the promo in percentage.", alias="mexFundedRatio") + mex_funded_amount: Optional[StrictInt] = Field(default=None, description="The merchant's promo fund in the minor unit. Calculated based on merchant funded ratio.", alias="mexFundedAmount") + targeted_price: Optional[StrictInt] = Field(default=None, description="The subtotal of the order basket in minor unit.", alias="targetedPrice") + promo_amount_in_min: Optional[StrictInt] = Field(default=None, description="Promo amount applied in the order in minor unit.", alias="promoAmountInMin") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "description", "name", "promoAmount", "mexFundedRatio", "mexFundedAmount", "targetedPrice", "promoAmountInMin"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderPromo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderPromo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "description": obj.get("description"), + "name": obj.get("name"), + "promoAmount": obj.get("promoAmount"), + "mexFundedRatio": obj.get("mexFundedRatio"), + "mexFundedAmount": obj.get("mexFundedAmount"), + "targetedPrice": obj.get("targetedPrice"), + "promoAmountInMin": obj.get("promoAmountInMin") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order_ready_estimation.py b/grabfood/models/order_ready_estimation.py new file mode 100644 index 0000000..8d31c46 --- /dev/null +++ b/grabfood/models/order_ready_estimation.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class OrderReadyEstimation(BaseModel): + """ + Information related to the order ready time estimation. + """ # noqa: E501 + allow_change: StrictBool = Field(description="A boolean value indicating if the order ready time can be changed.", alias="allowChange") + estimated_order_ready_time: datetime = Field(description="The order ready time for this order estimated by GrabFood, based on ISO_8601/RFC3339.", alias="estimatedOrderReadyTime") + max_order_ready_time: datetime = Field(description="The max allowed order ready time for this order, based on ISO_8601/RFC3339.", alias="maxOrderReadyTime") + new_order_ready_time: Optional[datetime] = Field(default=None, description="The new order ready time for this order. Only present after a new order ready time is set (default will be null), based on ISO_8601/RFC3339.", alias="newOrderReadyTime") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["allowChange", "estimatedOrderReadyTime", "maxOrderReadyTime", "newOrderReadyTime"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderReadyEstimation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if new_order_ready_time (nullable) is None + # and model_fields_set contains the field + if self.new_order_ready_time is None and "new_order_ready_time" in self.model_fields_set: + _dict['newOrderReadyTime'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderReadyEstimation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "allowChange": obj.get("allowChange"), + "estimatedOrderReadyTime": obj.get("estimatedOrderReadyTime"), + "maxOrderReadyTime": obj.get("maxOrderReadyTime"), + "newOrderReadyTime": obj.get("newOrderReadyTime") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/order_state_request.py b/grabfood/models/order_state_request.py new file mode 100644 index 0000000..b7b3faf --- /dev/null +++ b/grabfood/models/order_state_request.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class OrderStateRequest(BaseModel): + """ + This request pushes the state of an order on GrabFood. + """ # noqa: E501 + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + partner_merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is on the partner's database.", alias="partnerMerchantID") + order_id: StrictStr = Field(description="The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="orderID") + state: StrictStr = Field(description="The current order state. For takeaway orders, only `DELIVERED` and `CANCELLED` states are pushed.") + driver_eta: Optional[StrictInt] = Field(default=None, description="The driver's estimated of arrival (ETA) in seconds when the state is `DRIVER_ALLOCATED`.", alias="driverETA") + code: Optional[StrictStr] = Field(default=None, description="The current order's sub-state. This is in free text so you should only use for reference. Grab may use this for troubleshooting. If you want some analysis, kindly use `state` instead.") + message: Optional[StrictStr] = Field(default=None, description="Additional information to explain the current order state. May be system status or human entered message.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID", "partnerMerchantID", "orderID", "state", "driverETA", "code", "message"] + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ACCEPTED', 'DRIVER_ALLOCATED', 'DRIVER_ARRIVED', 'COLLECTED', 'DELIVERED', 'FAILED', 'CANCELLED']): + raise ValueError("must be one of enum values ('ACCEPTED', 'DRIVER_ALLOCATED', 'DRIVER_ARRIVED', 'COLLECTED', 'DELIVERED', 'FAILED', 'CANCELLED')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderStateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if driver_eta (nullable) is None + # and model_fields_set contains the field + if self.driver_eta is None and "driver_eta" in self.model_fields_set: + _dict['driverETA'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderStateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID"), + "partnerMerchantID": obj.get("partnerMerchantID"), + "orderID": obj.get("orderID"), + "state": obj.get("state"), + "driverETA": obj.get("driverETA"), + "code": obj.get("code"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/out_of_stock_instruction.py b/grabfood/models/out_of_stock_instruction.py new file mode 100644 index 0000000..191b245 --- /dev/null +++ b/grabfood/models/out_of_stock_instruction.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class OutOfStockInstruction(BaseModel): + """ + An JSON object that indicates the instructions to be taken by the merchant when the item is out of stock. + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="The short instruction message.") + instruction_type: Optional[StrictStr] = Field(default=None, description="Type of out-of-stock instruction chosen by customer. `CONTACT` is disabled by default, kindly reach out to your integration manager if you wish to receive this instruction.", alias="instructionType") + replacement_item_id: Optional[StrictStr] = Field(default=None, description="The preferred item's ID in the partner system. Only applicable when the instructionType is `SPECIFIC_ITEM`.", alias="replacementItemID") + replacement_grab_item_id: Optional[StrictStr] = Field(default=None, description="The preferred item's ID in the Grab system. Only applicable when the instructionType is `SPECIFIC_ITEM`.", alias="replacementGrabItemID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "instructionType", "replacementItemID", "replacementGrabItemID"] + + @field_validator('instruction_type') + def instruction_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['REMOVE', 'CANCEL', 'SPECIFIC_ITEM', 'CONTACT']): + raise ValueError("must be one of enum values ('REMOVE', 'CANCEL', 'SPECIFIC_ITEM', 'CONTACT')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OutOfStockInstruction from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OutOfStockInstruction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "instructionType": obj.get("instructionType"), + "replacementItemID": obj.get("replacementItemID"), + "replacementGrabItemID": obj.get("replacementGrabItemID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/partner_oauth_request.py b/grabfood/models/partner_oauth_request.py new file mode 100644 index 0000000..ec4730d --- /dev/null +++ b/grabfood/models/partner_oauth_request.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class PartnerOauthRequest(BaseModel): + """ + Information about GrabFood getting an OAuth access token from partners. + """ # noqa: E501 + client_id: Annotated[str, Field(strict=True, max_length=32)] = Field(description="The client identifier issued to obtain the OAuth access token.") + client_secret: Annotated[str, Field(strict=True, max_length=32)] = Field(description="The client secret issued to obtain the OAuth access token.") + grant_type: StrictStr = Field(description="Refers to the way an application gets OAuth access token.") + scope: Optional[StrictStr] = Field(default=None, description="A space delimited list of partner scopes.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["client_id", "client_secret", "grant_type", "scope"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PartnerOauthRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PartnerOauthRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "client_id": obj.get("client_id"), + "client_secret": obj.get("client_secret"), + "grant_type": obj.get("grant_type"), + "scope": obj.get("scope") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/partner_oauth_response.py b/grabfood/models/partner_oauth_response.py new file mode 100644 index 0000000..27f7c5a --- /dev/null +++ b/grabfood/models/partner_oauth_response.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PartnerOauthResponse(BaseModel): + """ + PartnerOauthResponse + """ # noqa: E501 + access_token: Optional[StrictStr] = Field(default=None, description="The OAuth 2.0 access token issued by the partner.") + token_type: Optional[StrictStr] = Field(default=None, description="The type of token issued which is case insensitive.") + expires_in: Optional[StrictInt] = Field(default=None, description="The access token lifespan in seconds.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["access_token", "token_type", "expires_in"] + + @field_validator('token_type') + def token_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Bearer']): + raise ValueError("must be one of enum values ('Bearer')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PartnerOauthResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PartnerOauthResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "access_token": obj.get("access_token"), + "token_type": obj.get("token_type"), + "expires_in": obj.get("expires_in") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/pause_store_request.py b/grabfood/models/pause_store_request.py new file mode 100644 index 0000000..920505d --- /dev/null +++ b/grabfood/models/pause_store_request.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PauseStoreRequest(BaseModel): + """ + This request pauses a store temporarily for (30 minutes/1 hour/24 hours) or unpauses a store on GrabFood. + """ # noqa: E501 + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + is_pause: StrictBool = Field(description="Boolean value to pause or unpause store.", alias="isPause") + duration: Optional[StrictStr] = Field(default=None, description="The duration to pause the store. Only required when `isPause=true`.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID", "isPause", "duration"] + + @field_validator('duration') + def duration_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['30m', '1h', '24h']): + raise ValueError("must be one of enum values ('30m', '1h', '24h')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PauseStoreRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PauseStoreRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID"), + "isPause": obj.get("isPause"), + "duration": obj.get("duration") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/purchasability.py b/grabfood/models/purchasability.py new file mode 100644 index 0000000..308540b --- /dev/null +++ b/grabfood/models/purchasability.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class Purchasability(BaseModel): + """ + Purchasability is set to true by default for all service type, unless it is explicitly set to false. Modifier will reuse it’s item’s purchasability. Refer [Service Based Menu](#section/Service-Based-Menu). + """ # noqa: E501 + delivery_on_demand_grab_app: Optional[StrictBool] = Field(default=None, alias="Delivery_OnDemand_GrabApp") + delivery_scheduled_grab_app: Optional[StrictBool] = Field(default=None, alias="Delivery_Scheduled_GrabApp") + self_pick_up_on_demand_grab_app: Optional[StrictBool] = Field(default=None, alias="SelfPickUp_OnDemand_GrabApp") + dine_in_on_demand_grab_app: Optional[StrictBool] = Field(default=None, alias="DineIn_OnDemand_GrabApp") + delivery_on_demand_store_front: Optional[StrictBool] = Field(default=None, alias="Delivery_OnDemand_StoreFront") + delivery_scheduled_store_front: Optional[StrictBool] = Field(default=None, alias="Delivery_Scheduled_StoreFront") + self_pick_up_on_demand_store_front: Optional[StrictBool] = Field(default=None, alias="SelfPickUp_OnDemand_StoreFront") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["Delivery_OnDemand_GrabApp", "Delivery_Scheduled_GrabApp", "SelfPickUp_OnDemand_GrabApp", "DineIn_OnDemand_GrabApp", "Delivery_OnDemand_StoreFront", "Delivery_Scheduled_StoreFront", "SelfPickUp_OnDemand_StoreFront"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Purchasability from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Purchasability from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "Delivery_OnDemand_GrabApp": obj.get("Delivery_OnDemand_GrabApp"), + "Delivery_Scheduled_GrabApp": obj.get("Delivery_Scheduled_GrabApp"), + "SelfPickUp_OnDemand_GrabApp": obj.get("SelfPickUp_OnDemand_GrabApp"), + "DineIn_OnDemand_GrabApp": obj.get("DineIn_OnDemand_GrabApp"), + "Delivery_OnDemand_StoreFront": obj.get("Delivery_OnDemand_StoreFront"), + "Delivery_Scheduled_StoreFront": obj.get("Delivery_Scheduled_StoreFront"), + "SelfPickUp_OnDemand_StoreFront": obj.get("SelfPickUp_OnDemand_StoreFront") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/push_integration_status_webhook_request.py b/grabfood/models/push_integration_status_webhook_request.py new file mode 100644 index 0000000..c16d1e2 --- /dev/null +++ b/grabfood/models/push_integration_status_webhook_request.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class PushIntegrationStatusWebhookRequest(BaseModel): + """ + + """ # noqa: E501 + partner_merchant_id: StrictStr = Field(description="The merchant's ID that is on the partner's database.", alias="partnerMerchantID") + grab_merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="grabMerchantID") + integration_status: StrictStr = Field(description="The store integration status. - `INACTIVE`: Merchant integration deactivated - `ACTIVE`: Merchant integration activated - `SYNCING`: Merchant integration is syncing - `FAILED`: Merchant integration has failed ", alias="integrationStatus") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["partnerMerchantID", "grabMerchantID", "integrationStatus"] + + @field_validator('integration_status') + def integration_status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['INACTIVE', 'ACTIVE', 'SYNCING', 'FAILED']): + raise ValueError("must be one of enum values ('INACTIVE', 'ACTIVE', 'SYNCING', 'FAILED')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PushIntegrationStatusWebhookRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PushIntegrationStatusWebhookRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "partnerMerchantID": obj.get("partnerMerchantID"), + "grabMerchantID": obj.get("grabMerchantID"), + "integrationStatus": obj.get("integrationStatus") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/receiver.py b/grabfood/models/receiver.py new file mode 100644 index 0000000..49c1494 --- /dev/null +++ b/grabfood/models/receiver.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.address import Address +from typing import Optional, Set +from typing_extensions import Self + +class Receiver(BaseModel): + """ + A JSON object containing the receiver information. Only applicable for orders that are delivered by the restaurant. `null` if not applicable. + """ # noqa: E501 + name: Optional[Annotated[str, Field(strict=True, max_length=64)]] = Field(default=None, description="The name of the receiver.") + phones: Optional[StrictStr] = Field(default=None, description="The receiver's phone number.") + address: Optional[Address] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "phones", "address"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Receiver from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of address + if self.address: + _dict['address'] = self.address.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Receiver from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "phones": obj.get("phones"), + "address": Address.from_dict(obj["address"]) if obj.get("address") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/redeem_dine_in_voucher_request.py b/grabfood/models/redeem_dine_in_voucher_request.py new file mode 100644 index 0000000..d59e6ee --- /dev/null +++ b/grabfood/models/redeem_dine_in_voucher_request.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class RedeemDineInVoucherRequest(BaseModel): + """ + Dine in voucher redemption + """ # noqa: E501 + certificate_id: StrictStr = Field(description="This certificateID is decoded from scanning the QR code, and 1:1 mapping with `voucherCode`.", alias="certificateID") + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["certificateID", "merchantID"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemDineInVoucherRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemDineInVoucherRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "certificateID": obj.get("certificateID"), + "merchantID": obj.get("merchantID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/redeem_dine_in_voucher_response.py b/grabfood/models/redeem_dine_in_voucher_response.py new file mode 100644 index 0000000..8f9a65d --- /dev/null +++ b/grabfood/models/redeem_dine_in_voucher_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.redeem_result import RedeemResult +from grabfood.models.voucher import Voucher +from typing import Optional, Set +from typing_extensions import Self + +class RedeemDineInVoucherResponse(BaseModel): + """ + + """ # noqa: E501 + certificate_id: Optional[StrictStr] = Field(default=None, description="This certificateID is decoded from scanning the QR code, and 1:1 mapping with `voucherCode`.", alias="certificateID") + voucher_code: Optional[Annotated[str, Field(strict=True, max_length=11)]] = Field(default=None, description="A short code for the dine-in voucher purchased by the user.", alias="voucherCode") + voucher: Optional[Voucher] = None + redeem_result: Optional[RedeemResult] = Field(default=None, alias="redeemResult") + merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + campaign_id: Optional[StrictStr] = Field(default=None, description="The dine-in voucher campaign's ID in GrabFood's database.", alias="campaignID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["certificateID", "voucherCode", "voucher", "redeemResult", "merchantID", "campaignID"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemDineInVoucherResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of redeem_result + if self.redeem_result: + _dict['redeemResult'] = self.redeem_result.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemDineInVoucherResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "certificateID": obj.get("certificateID"), + "voucherCode": obj.get("voucherCode"), + "voucher": Voucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "redeemResult": RedeemResult.from_dict(obj["redeemResult"]) if obj.get("redeemResult") is not None else None, + "merchantID": obj.get("merchantID"), + "campaignID": obj.get("campaignID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/redeem_result.py b/grabfood/models/redeem_result.py new file mode 100644 index 0000000..355f5a0 --- /dev/null +++ b/grabfood/models/redeem_result.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedeemResult(BaseModel): + """ + A JSON object containing dine-in voucher details. + """ # noqa: E501 + success: Optional[StrictBool] = Field(default=None, description="To indicate whether the dine-in voucher redemption succeeded.") + code: Optional[StrictStr] = Field(default=None, description="The code for the reason of failed redemption. Empty if the `success` is true. * `VOUCHER_REDEEMED` - The voucher has already been redeemed. * `INVALID_STATE` - The current status of voucher is EXPIRED or REFUNDED. * `REDEEM_FAILED` - Internal service error. * `INVALID_MERCHANT` - Voucher not applicable for this merchant. * `INVALID_ID` - Invalid certificateID. ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["success", "code"] + + @field_validator('code') + def code_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['VOUCHER_REDEEMED', 'INVALID_STATE', 'REDEEM_FAILED', 'INVALID_MERCHANT', 'INVALID_ID', '']): + raise ValueError("must be one of enum values ('VOUCHER_REDEEMED', 'INVALID_STATE', 'REDEEM_FAILED', 'INVALID_MERCHANT', 'INVALID_ID', '')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "success": obj.get("success"), + "code": obj.get("code") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/register_membership_native_request.py b/grabfood/models/register_membership_native_request.py new file mode 100644 index 0000000..8185ebb --- /dev/null +++ b/grabfood/models/register_membership_native_request.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RegisterMembershipNativeRequest(BaseModel): + """ + This request submits membership registration request to partner. + """ # noqa: E501 + grab_id: StrictStr = Field(description="The id used to identify an unique grab user.", alias="grabID") + phone_number: Optional[StrictStr] = Field(default=None, description="Grab user's phone number for registration.", alias="phoneNumber") + name: Optional[StrictStr] = Field(default=None, description="Grab user's name for registration.") + email: Optional[StrictStr] = Field(default=None, description="Grab user's email address for registration.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["grabID", "phoneNumber", "name", "email"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RegisterMembershipNativeRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RegisterMembershipNativeRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "grabID": obj.get("grabID"), + "phoneNumber": obj.get("phoneNumber"), + "name": obj.get("name"), + "email": obj.get("email") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/register_membership_native_response.py b/grabfood/models/register_membership_native_response.py new file mode 100644 index 0000000..8e29896 --- /dev/null +++ b/grabfood/models/register_membership_native_response.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class RegisterMembershipNativeResponse(BaseModel): + """ + This response returns membershipID after membership binding is successful. + """ # noqa: E501 + member_id: StrictStr = Field(description="The unique member ID on the partner's database.", alias="memberID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["memberID"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RegisterMembershipNativeResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RegisterMembershipNativeResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "memberID": obj.get("memberID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/reward_item.py b/grabfood/models/reward_item.py new file mode 100644 index 0000000..3a63455 --- /dev/null +++ b/grabfood/models/reward_item.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardItem(BaseModel): + """ + RewardItem + """ # noqa: E501 + item_id: Optional[StrictStr] = Field(default=None, description="The item's ID in partner system.", alias="itemID") + quantity: Optional[StrictInt] = Field(default=None, description="The item's quantity.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["itemID", "quantity"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "itemID": obj.get("itemID"), + "quantity": obj.get("quantity") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/selling_time.py b/grabfood/models/selling_time.py new file mode 100644 index 0000000..a3a1c85 --- /dev/null +++ b/grabfood/models/selling_time.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.service_hours import ServiceHours +from typing import Optional, Set +from typing_extensions import Self + +class SellingTime(BaseModel): + """ + SellingTime + """ # noqa: E501 + start_time: Optional[StrictStr] = Field(default=None, description="The selling time group start time in date & time format. UTC format is expected. ", alias="startTime") + end_time: Optional[StrictStr] = Field(default=None, description="The selling time group end time in date & time format. UTC format is expected. ", alias="endTime") + id: Optional[Annotated[str, Field(strict=True, max_length=64)]] = Field(default=None, description="The selling time's ID on the partner system. This ID should be unique with length min 1 and max 64. ") + name: Optional[Annotated[str, Field(strict=True, max_length=30)]] = Field(default=None, description="The name of the selling time. ") + service_hours: Optional[ServiceHours] = Field(default=None, alias="serviceHours") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["startTime", "endTime", "id", "name", "serviceHours"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SellingTime from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of service_hours + if self.service_hours: + _dict['serviceHours'] = self.service_hours.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SellingTime from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "startTime": obj.get("startTime"), + "endTime": obj.get("endTime"), + "id": obj.get("id"), + "name": obj.get("name"), + "serviceHours": ServiceHours.from_dict(obj["serviceHours"]) if obj.get("serviceHours") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/service_hour.py b/grabfood/models/service_hour.py new file mode 100644 index 0000000..951ba3f --- /dev/null +++ b/grabfood/models/service_hour.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.open_period import OpenPeriod +from typing import Optional, Set +from typing_extensions import Self + +class ServiceHour(BaseModel): + """ + A JSON object serviceHour for each day. An empty JSON object indicates the menu item is not available on the day. + """ # noqa: E501 + open_period_type: StrictStr = Field(description="Defines the specific time period during which the menu is available - OpenPeriod = open only in given periods - OpenAllDay = open 24 hours - CloseAllDay = closed 24 hours ", alias="openPeriodType") + periods: Optional[List[OpenPeriod]] = Field(default=None, description="An array of open periods. Only required when `openPeriodType` is **OpenPeriod**") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["openPeriodType", "periods"] + + @field_validator('open_period_type') + def open_period_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['OpenPeriod', 'OpenAllDay', 'CloseAllDay']): + raise ValueError("must be one of enum values ('OpenPeriod', 'OpenAllDay', 'CloseAllDay')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceHour from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in periods (list) + _items = [] + if self.periods: + for _item_periods in self.periods: + if _item_periods: + _items.append(_item_periods.to_dict()) + _dict['periods'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceHour from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openPeriodType": obj.get("openPeriodType"), + "periods": [OpenPeriod.from_dict(_item) for _item in obj["periods"]] if obj.get("periods") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/service_hours.py b/grabfood/models/service_hours.py new file mode 100644 index 0000000..2d5723f --- /dev/null +++ b/grabfood/models/service_hours.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from grabfood.models.service_hour import ServiceHour +from typing import Optional, Set +from typing_extensions import Self + +class ServiceHours(BaseModel): + """ + A JSON object with serviceHours for each day of the week. + """ # noqa: E501 + mon: ServiceHour + tue: ServiceHour + wed: ServiceHour + thu: ServiceHour + fri: ServiceHour + sat: ServiceHour + sun: ServiceHour + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceHours from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of mon + if self.mon: + _dict['mon'] = self.mon.to_dict() + # override the default output from pydantic by calling `to_dict()` of tue + if self.tue: + _dict['tue'] = self.tue.to_dict() + # override the default output from pydantic by calling `to_dict()` of wed + if self.wed: + _dict['wed'] = self.wed.to_dict() + # override the default output from pydantic by calling `to_dict()` of thu + if self.thu: + _dict['thu'] = self.thu.to_dict() + # override the default output from pydantic by calling `to_dict()` of fri + if self.fri: + _dict['fri'] = self.fri.to_dict() + # override the default output from pydantic by calling `to_dict()` of sat + if self.sat: + _dict['sat'] = self.sat.to_dict() + # override the default output from pydantic by calling `to_dict()` of sun + if self.sun: + _dict['sun'] = self.sun.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceHours from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mon": ServiceHour.from_dict(obj["mon"]) if obj.get("mon") is not None else None, + "tue": ServiceHour.from_dict(obj["tue"]) if obj.get("tue") is not None else None, + "wed": ServiceHour.from_dict(obj["wed"]) if obj.get("wed") is not None else None, + "thu": ServiceHour.from_dict(obj["thu"]) if obj.get("thu") is not None else None, + "fri": ServiceHour.from_dict(obj["fri"]) if obj.get("fri") is not None else None, + "sat": ServiceHour.from_dict(obj["sat"]) if obj.get("sat") is not None else None, + "sun": ServiceHour.from_dict(obj["sun"]) if obj.get("sun") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/special_opening_hour.py b/grabfood/models/special_opening_hour.py new file mode 100644 index 0000000..299b76b --- /dev/null +++ b/grabfood/models/special_opening_hour.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.special_opening_hour_metadata import SpecialOpeningHourMetadata +from grabfood.models.special_opening_hour_opening_hours import SpecialOpeningHourOpeningHours +from typing import Optional, Set +from typing_extensions import Self + +class SpecialOpeningHour(BaseModel): + """ + SpecialOpeningHour + """ # noqa: E501 + start_date: Optional[StrictStr] = Field(default=None, description="The start date of store special opening hours.", alias="startDate") + end_date: Optional[StrictStr] = Field(default=None, description="The end date of store special opening hours.", alias="endDate") + metadata: Optional[SpecialOpeningHourMetadata] = None + opening_hours: Optional[SpecialOpeningHourOpeningHours] = Field(default=None, alias="openingHours") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["startDate", "endDate", "metadata", "openingHours"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SpecialOpeningHour from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of opening_hours + if self.opening_hours: + _dict['openingHours'] = self.opening_hours.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SpecialOpeningHour from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "metadata": SpecialOpeningHourMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "openingHours": SpecialOpeningHourOpeningHours.from_dict(obj["openingHours"]) if obj.get("openingHours") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/special_opening_hour_metadata.py b/grabfood/models/special_opening_hour_metadata.py new file mode 100644 index 0000000..ff345d4 --- /dev/null +++ b/grabfood/models/special_opening_hour_metadata.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SpecialOpeningHourMetadata(BaseModel): + """ + Contains special opening hour info. + """ # noqa: E501 + description: Optional[StrictStr] = Field(default=None, description="Description of the special opening hour.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["description"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SpecialOpeningHourMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SpecialOpeningHourMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "description": obj.get("description") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/special_opening_hour_opening_hours.py b/grabfood/models/special_opening_hour_opening_hours.py new file mode 100644 index 0000000..a70cfc7 --- /dev/null +++ b/grabfood/models/special_opening_hour_opening_hours.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.open_period import OpenPeriod +from typing import Optional, Set +from typing_extensions import Self + +class SpecialOpeningHourOpeningHours(BaseModel): + """ + Store special opening hour period. + """ # noqa: E501 + open_period_type: Optional[StrictStr] = Field(default=None, description="The period type for when the outlet is open.", alias="openPeriodType") + periods: Optional[List[OpenPeriod]] = Field(default=None, description="An array of open periods. Maximum of 3 periods.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["openPeriodType", "periods"] + + @field_validator('open_period_type') + def open_period_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Period', 'OpenAllDay', 'ClosedAllDay']): + raise ValueError("must be one of enum values ('Period', 'OpenAllDay', 'ClosedAllDay')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SpecialOpeningHourOpeningHours from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in periods (list) + _items = [] + if self.periods: + for _item_periods in self.periods: + if _item_periods: + _items.append(_item_periods.to_dict()) + _dict['periods'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SpecialOpeningHourOpeningHours from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openPeriodType": obj.get("openPeriodType"), + "periods": [OpenPeriod.from_dict(_item) for _item in obj["periods"]] if obj.get("periods") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/store_hour.py b/grabfood/models/store_hour.py new file mode 100644 index 0000000..11b08e2 --- /dev/null +++ b/grabfood/models/store_hour.py @@ -0,0 +1,164 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from grabfood.models.open_period import OpenPeriod +from typing import Optional, Set +from typing_extensions import Self + +class StoreHour(BaseModel): + """ + A JSON object that describes the store hour for each day. + """ # noqa: E501 + mon: List[OpenPeriod] = Field(description="An array of open periods. Maximum of 3 periods. Blank indicates store close.") + tue: List[OpenPeriod] = Field(description="An array of open periods. Maximum of 3 periods. Blank indicates store close.") + wed: List[OpenPeriod] = Field(description="An array of open periods. Maximum of 3 periods. Blank indicates store close.") + thu: List[OpenPeriod] = Field(description="An array of open periods. Maximum of 3 periods. Blank indicates store close.") + fri: List[OpenPeriod] = Field(description="An array of open periods. Maximum of 3 periods. Blank indicates store close.") + sat: List[OpenPeriod] = Field(description="An array of open periods. Maximum of 3 periods. Blank indicates store close.") + sun: List[OpenPeriod] = Field(description="An array of open periods. Maximum of 3 periods. Blank indicates store close.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StoreHour from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in mon (list) + _items = [] + if self.mon: + for _item_mon in self.mon: + if _item_mon: + _items.append(_item_mon.to_dict()) + _dict['mon'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in tue (list) + _items = [] + if self.tue: + for _item_tue in self.tue: + if _item_tue: + _items.append(_item_tue.to_dict()) + _dict['tue'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in wed (list) + _items = [] + if self.wed: + for _item_wed in self.wed: + if _item_wed: + _items.append(_item_wed.to_dict()) + _dict['wed'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in thu (list) + _items = [] + if self.thu: + for _item_thu in self.thu: + if _item_thu: + _items.append(_item_thu.to_dict()) + _dict['thu'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in fri (list) + _items = [] + if self.fri: + for _item_fri in self.fri: + if _item_fri: + _items.append(_item_fri.to_dict()) + _dict['fri'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in sat (list) + _items = [] + if self.sat: + for _item_sat in self.sat: + if _item_sat: + _items.append(_item_sat.to_dict()) + _dict['sat'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in sun (list) + _items = [] + if self.sun: + for _item_sun in self.sun: + if _item_sun: + _items.append(_item_sun.to_dict()) + _dict['sun'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StoreHour from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mon": [OpenPeriod.from_dict(_item) for _item in obj["mon"]] if obj.get("mon") is not None else None, + "tue": [OpenPeriod.from_dict(_item) for _item in obj["tue"]] if obj.get("tue") is not None else None, + "wed": [OpenPeriod.from_dict(_item) for _item in obj["wed"]] if obj.get("wed") is not None else None, + "thu": [OpenPeriod.from_dict(_item) for _item in obj["thu"]] if obj.get("thu") is not None else None, + "fri": [OpenPeriod.from_dict(_item) for _item in obj["fri"]] if obj.get("fri") is not None else None, + "sat": [OpenPeriod.from_dict(_item) for _item in obj["sat"]] if obj.get("sat") is not None else None, + "sun": [OpenPeriod.from_dict(_item) for _item in obj["sun"]] if obj.get("sun") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/store_hour_response.py b/grabfood/models/store_hour_response.py new file mode 100644 index 0000000..aba4c55 --- /dev/null +++ b/grabfood/models/store_hour_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.special_opening_hour import SpecialOpeningHour +from grabfood.models.store_hour import StoreHour +from typing import Optional, Set +from typing_extensions import Self + +class StoreHourResponse(BaseModel): + """ + Object contain store hour info + """ # noqa: E501 + dine_in_hour: Optional[StoreHour] = Field(default=None, alias="dineInHour") + opening_hour: Optional[StoreHour] = Field(default=None, alias="openingHour") + special_opening_hours: Optional[List[SpecialOpeningHour]] = Field(default=None, description="The store's special opening hours.", alias="specialOpeningHours") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["dineInHour", "openingHour", "specialOpeningHours"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StoreHourResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of dine_in_hour + if self.dine_in_hour: + _dict['dineInHour'] = self.dine_in_hour.to_dict() + # override the default output from pydantic by calling `to_dict()` of opening_hour + if self.opening_hour: + _dict['openingHour'] = self.opening_hour.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in special_opening_hours (list) + _items = [] + if self.special_opening_hours: + for _item_special_opening_hours in self.special_opening_hours: + if _item_special_opening_hours: + _items.append(_item_special_opening_hours.to_dict()) + _dict['specialOpeningHours'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StoreHourResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dineInHour": StoreHour.from_dict(obj["dineInHour"]) if obj.get("dineInHour") is not None else None, + "openingHour": StoreHour.from_dict(obj["openingHour"]) if obj.get("openingHour") is not None else None, + "specialOpeningHours": [SpecialOpeningHour.from_dict(_item) for _item in obj["specialOpeningHours"]] if obj.get("specialOpeningHours") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/store_status_response.py b/grabfood/models/store_status_response.py new file mode 100644 index 0000000..18485c5 --- /dev/null +++ b/grabfood/models/store_status_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class StoreStatusResponse(BaseModel): + """ + Object contains store status info + """ # noqa: E501 + close_reason: StrictStr = Field(description="The code of store close reason. Blank indicates store is currently open.", alias="closeReason") + is_in_special_opening_hour_range: StrictBool = Field(description="Indicate whether the store is in special opening hour range.", alias="isInSpecialOpeningHourRange") + is_open: StrictBool = Field(description="Indicate whether the store is open.", alias="isOpen") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["closeReason", "isInSpecialOpeningHourRange", "isOpen"] + + @field_validator('close_reason') + def close_reason_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['mex_paused', 'ops_paused', 'out_of_special_opening_hours', 'out_of_opening_hours', 'inactive', 'ops_paused_without_comm', 'restricted', 'suspended', 'parse_data_fail', '']): + raise ValueError("must be one of enum values ('mex_paused', 'ops_paused', 'out_of_special_opening_hours', 'out_of_opening_hours', 'inactive', 'ops_paused_without_comm', 'restricted', 'suspended', 'parse_data_fail', '')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StoreStatusResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StoreStatusResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "closeReason": obj.get("closeReason"), + "isInSpecialOpeningHourRange": obj.get("isInSpecialOpeningHourRange"), + "isOpen": obj.get("isOpen") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/submit_order_request.py b/grabfood/models/submit_order_request.py new file mode 100644 index 0000000..6554ff4 --- /dev/null +++ b/grabfood/models/submit_order_request.py @@ -0,0 +1,218 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.currency import Currency +from grabfood.models.dine_in import DineIn +from grabfood.models.order_campaign import OrderCampaign +from grabfood.models.order_feature_flags import OrderFeatureFlags +from grabfood.models.order_item import OrderItem +from grabfood.models.order_price import OrderPrice +from grabfood.models.order_promo import OrderPromo +from grabfood.models.order_ready_estimation import OrderReadyEstimation +from grabfood.models.receiver import Receiver +from typing import Optional, Set +from typing_extensions import Self + +class SubmitOrderRequest(BaseModel): + """ + A JSON object containing the order information. + """ # noqa: E501 + order_id: StrictStr = Field(description="The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="orderID") + short_order_number: StrictStr = Field(description="The GrabFood short order number. This is unique for each merchant per day. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).", alias="shortOrderNumber") + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + partner_merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is on the partner's database.", alias="partnerMerchantID") + payment_type: StrictStr = Field(description="The payment method used. Refer to FAQs for more details about [paymentType](#section/Order/Does-the-paymentType-affect-partners).", alias="paymentType") + cutlery: StrictBool = Field(description="The boolean value to indicate whether cutlery are needed or not. Refer to FAQs for more details about [cutlery](#section/Order/What-do-the-true-or-false-values-mean-for-cutlery).") + order_time: StrictStr = Field(description="The UTC time that a consumer places the order, based on ISO_8601/RFC3339.", alias="orderTime") + submit_time: Optional[datetime] = Field(default=None, description="The order submit time, based on ISO_8601/RFC3339. `null` in Submit Order payload. Only present in the [List Orders](#tag/list-order) response.", alias="submitTime") + complete_time: Optional[datetime] = Field(default=None, description="The order complete time, based on ISO_8601/RFC3339. `null` in Submit Order payload. Only present in the [List Orders](#tag/list-order) response.", alias="completeTime") + scheduled_time: Optional[StrictStr] = Field(default=None, description="The order scheduled time, based on ISO_8601/RFC3339. Empty for non-scheduled orders.", alias="scheduledTime") + order_state: Optional[StrictStr] = Field(default=None, description="The state of the order. Empty in Submit Order payload. Only present in the [List Orders](#tag/list-order) response. Refer to [Order States](#section/Order-states).", alias="orderState") + currency: Currency + feature_flags: OrderFeatureFlags = Field(alias="featureFlags") + items: List[OrderItem] = Field(description="The ordered items in an array of JSON Object. ") + campaigns: Optional[List[OrderCampaign]] = Field(default=None, description="The campaigns that are applicable for the order. `null` when there is no campaign applied. Only campaigns that are funded by merchants will be sent. ") + promos: Optional[List[OrderPromo]] = Field(default=None, description="An array of promotion objects. `null` when there is no promo code applied. Only promotions that are funded by merchants will be sent.") + price: OrderPrice + dine_in: Optional[DineIn] = Field(default=None, alias="dineIn") + receiver: Optional[Receiver] = None + order_ready_estimation: Optional[OrderReadyEstimation] = Field(default=None, alias="orderReadyEstimation") + membership_id: Optional[StrictStr] = Field(default=None, description="Membership ID for loyalty project. Only present for loyalty program partners. Empty if not applicable.", alias="membershipID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["orderID", "shortOrderNumber", "merchantID", "partnerMerchantID", "paymentType", "cutlery", "orderTime", "submitTime", "completeTime", "scheduledTime", "orderState", "currency", "featureFlags", "items", "campaigns", "promos", "price", "dineIn", "receiver", "orderReadyEstimation", "membershipID"] + + @field_validator('payment_type') + def payment_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['CASH', 'CASHLESS']): + raise ValueError("must be one of enum values ('CASH', 'CASHLESS')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubmitOrderRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of currency + if self.currency: + _dict['currency'] = self.currency.to_dict() + # override the default output from pydantic by calling `to_dict()` of feature_flags + if self.feature_flags: + _dict['featureFlags'] = self.feature_flags.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in campaigns (list) + _items = [] + if self.campaigns: + for _item_campaigns in self.campaigns: + if _item_campaigns: + _items.append(_item_campaigns.to_dict()) + _dict['campaigns'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in promos (list) + _items = [] + if self.promos: + for _item_promos in self.promos: + if _item_promos: + _items.append(_item_promos.to_dict()) + _dict['promos'] = _items + # override the default output from pydantic by calling `to_dict()` of price + if self.price: + _dict['price'] = self.price.to_dict() + # override the default output from pydantic by calling `to_dict()` of dine_in + if self.dine_in: + _dict['dineIn'] = self.dine_in.to_dict() + # override the default output from pydantic by calling `to_dict()` of receiver + if self.receiver: + _dict['receiver'] = self.receiver.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_ready_estimation + if self.order_ready_estimation: + _dict['orderReadyEstimation'] = self.order_ready_estimation.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if campaigns (nullable) is None + # and model_fields_set contains the field + if self.campaigns is None and "campaigns" in self.model_fields_set: + _dict['campaigns'] = None + + # set to None if promos (nullable) is None + # and model_fields_set contains the field + if self.promos is None and "promos" in self.model_fields_set: + _dict['promos'] = None + + # set to None if dine_in (nullable) is None + # and model_fields_set contains the field + if self.dine_in is None and "dine_in" in self.model_fields_set: + _dict['dineIn'] = None + + # set to None if receiver (nullable) is None + # and model_fields_set contains the field + if self.receiver is None and "receiver" in self.model_fields_set: + _dict['receiver'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubmitOrderRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "orderID": obj.get("orderID"), + "shortOrderNumber": obj.get("shortOrderNumber"), + "merchantID": obj.get("merchantID"), + "partnerMerchantID": obj.get("partnerMerchantID"), + "paymentType": obj.get("paymentType"), + "cutlery": obj.get("cutlery"), + "orderTime": obj.get("orderTime"), + "submitTime": obj.get("submitTime"), + "completeTime": obj.get("completeTime"), + "scheduledTime": obj.get("scheduledTime"), + "orderState": obj.get("orderState"), + "currency": Currency.from_dict(obj["currency"]) if obj.get("currency") is not None else None, + "featureFlags": OrderFeatureFlags.from_dict(obj["featureFlags"]) if obj.get("featureFlags") is not None else None, + "items": [OrderItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "campaigns": [OrderCampaign.from_dict(_item) for _item in obj["campaigns"]] if obj.get("campaigns") is not None else None, + "promos": [OrderPromo.from_dict(_item) for _item in obj["promos"]] if obj.get("promos") is not None else None, + "price": OrderPrice.from_dict(obj["price"]) if obj.get("price") is not None else None, + "dineIn": DineIn.from_dict(obj["dineIn"]) if obj.get("dineIn") is not None else None, + "receiver": Receiver.from_dict(obj["receiver"]) if obj.get("receiver") is not None else None, + "orderReadyEstimation": OrderReadyEstimation.from_dict(obj["orderReadyEstimation"]) if obj.get("orderReadyEstimation") is not None else None, + "membershipID": obj.get("membershipID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/unbind_membership_native_request.py b/grabfood/models/unbind_membership_native_request.py new file mode 100644 index 0000000..437629d --- /dev/null +++ b/grabfood/models/unbind_membership_native_request.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class UnbindMembershipNativeRequest(BaseModel): + """ + This request submits membership unbind request to partner. + """ # noqa: E501 + member_id: StrictStr = Field(description="The unique member ID on the partner's database.", alias="memberID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["memberID"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UnbindMembershipNativeRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UnbindMembershipNativeRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "memberID": obj.get("memberID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/unlink_membership_webview_request.py b/grabfood/models/unlink_membership_webview_request.py new file mode 100644 index 0000000..5407c40 --- /dev/null +++ b/grabfood/models/unlink_membership_webview_request.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class UnlinkMembershipWebviewRequest(BaseModel): + """ + This request submits membership unbind request to partner. + """ # noqa: E501 + member_id: StrictStr = Field(description="The unique member ID on the partner's database.", alias="memberID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["memberID"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UnlinkMembershipWebviewRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UnlinkMembershipWebviewRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "memberID": obj.get("memberID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_advanced_pricing.py b/grabfood/models/update_advanced_pricing.py new file mode 100644 index 0000000..74e0ac0 --- /dev/null +++ b/grabfood/models/update_advanced_pricing.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class UpdateAdvancedPricing(BaseModel): + """ + UpdateAdvancedPricing + """ # noqa: E501 + key: Optional[StrictStr] = Field(default=None, description="Available service type.") + price: Optional[StrictInt] = Field(default=None, description="Price in minor unit.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "price"] + + @field_validator('key') + def key_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Delivery_OnDemand_GrabApp', 'Delivery_Scheduled_GrabApp', 'SelfPickUp_OnDemand_GrabApp', 'DineIn_OnDemand_GrabApp', 'Delivery_OnDemand_StoreFront', 'Delivery_Scheduled_StoreFront', 'SelfPickUp_OnDemand_StoreFront']): + raise ValueError("must be one of enum values ('Delivery_OnDemand_GrabApp', 'Delivery_Scheduled_GrabApp', 'SelfPickUp_OnDemand_GrabApp', 'DineIn_OnDemand_GrabApp', 'Delivery_OnDemand_StoreFront', 'Delivery_Scheduled_StoreFront', 'SelfPickUp_OnDemand_StoreFront')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateAdvancedPricing from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateAdvancedPricing from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "price": obj.get("price") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_campaign_request.py b/grabfood/models/update_campaign_request.py new file mode 100644 index 0000000..fa3fc5b --- /dev/null +++ b/grabfood/models/update_campaign_request.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from grabfood.models.campaign_conditions import CampaignConditions +from grabfood.models.campaign_discount import CampaignDiscount +from grabfood.models.campaign_quotas import CampaignQuotas +from typing import Optional, Set +from typing_extensions import Self + +class UpdateCampaignRequest(BaseModel): + """ + This request updates a campaign for your GrabFood store. + """ # noqa: E501 + merchant_id: Optional[StrictStr] = Field(default=None, description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + name: Optional[StrictStr] = Field(default=None, description="The campaign's name.") + quotas: Optional[CampaignQuotas] = None + conditions: Optional[CampaignConditions] = None + discount: Optional[CampaignDiscount] = None + custom_tag: Optional[Annotated[str, Field(strict=True, max_length=22)]] = Field(default=None, description="Specify the tag for custom bundle offer campaign. Only whitelisted partner is supported as of now.", alias="customTag") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID", "name", "quotas", "conditions", "discount", "customTag"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateCampaignRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of quotas + if self.quotas: + _dict['quotas'] = self.quotas.to_dict() + # override the default output from pydantic by calling `to_dict()` of conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # override the default output from pydantic by calling `to_dict()` of discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateCampaignRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID"), + "name": obj.get("name"), + "quotas": CampaignQuotas.from_dict(obj["quotas"]) if obj.get("quotas") is not None else None, + "conditions": CampaignConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "discount": CampaignDiscount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "customTag": obj.get("customTag") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_delivery_hour_request.py b/grabfood/models/update_delivery_hour_request.py new file mode 100644 index 0000000..93e7dba --- /dev/null +++ b/grabfood/models/update_delivery_hour_request.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List +from grabfood.models.store_hour import StoreHour +from typing import Optional, Set +from typing_extensions import Self + +class UpdateDeliveryHourRequest(BaseModel): + """ + Object contains store delivery hours. + """ # noqa: E501 + opening_hour: StoreHour = Field(alias="openingHour") + force: StrictBool = Field(description="To enable force update store delivery hours. Error will be returned if set to false while there is ongoing order.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["openingHour", "force"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateDeliveryHourRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of opening_hour + if self.opening_hour: + _dict['openingHour'] = self.opening_hour.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateDeliveryHourRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openingHour": StoreHour.from_dict(obj["openingHour"]) if obj.get("openingHour") is not None else None, + "force": obj.get("force") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_delivery_hour_response.py b/grabfood/models/update_delivery_hour_response.py new file mode 100644 index 0000000..d87ff0e --- /dev/null +++ b/grabfood/models/update_delivery_hour_response.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class UpdateDeliveryHourResponse(BaseModel): + """ + Object contain update store delivery hour response + """ # noqa: E501 + error_reasons: Optional[List[StrictStr]] = Field(default=None, description="Error message when updating store delivery hour. `null` indicates no error.", alias="errorReasons") + order_count: StrictInt = Field(description="Total active order for the day.", alias="orderCount") + scheduled_order_count: StrictInt = Field(description="Total scheduled order during store close period.", alias="scheduledOrderCount") + close_immediately: StrictBool = Field(description="Indicate the store status after updating delivery hours.", alias="closeImmediately") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["errorReasons", "orderCount", "scheduledOrderCount", "closeImmediately"] + + @field_validator('error_reasons') + def error_reasons_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['ClosingHoursIneffective', 'ForceUpdated', 'PendingScheduledOrders', 'PendingOrders']): + raise ValueError("each list item must be one of ('ClosingHoursIneffective', 'ForceUpdated', 'PendingScheduledOrders', 'PendingOrders')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateDeliveryHourResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if error_reasons (nullable) is None + # and model_fields_set contains the field + if self.error_reasons is None and "error_reasons" in self.model_fields_set: + _dict['errorReasons'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateDeliveryHourResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "errorReasons": obj.get("errorReasons"), + "orderCount": obj.get("orderCount"), + "scheduledOrderCount": obj.get("scheduledOrderCount"), + "closeImmediately": obj.get("closeImmediately") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_dine_in_hour_request.py b/grabfood/models/update_dine_in_hour_request.py new file mode 100644 index 0000000..7ebcf28 --- /dev/null +++ b/grabfood/models/update_dine_in_hour_request.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from grabfood.models.store_hour import StoreHour +from typing import Optional, Set +from typing_extensions import Self + +class UpdateDineInHourRequest(BaseModel): + """ + Object contains store dine-in hours. + """ # noqa: E501 + dine_in_hour: StoreHour = Field(alias="dineInHour") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["dineInHour"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateDineInHourRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of dine_in_hour + if self.dine_in_hour: + _dict['dineInHour'] = self.dine_in_hour.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateDineInHourRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dineInHour": StoreHour.from_dict(obj["dineInHour"]) if obj.get("dineInHour") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_dine_in_hour_response.py b/grabfood/models/update_dine_in_hour_response.py new file mode 100644 index 0000000..cff140a --- /dev/null +++ b/grabfood/models/update_dine_in_hour_response.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class UpdateDineInHourResponse(BaseModel): + """ + Object contain update store dine-in hour response + """ # noqa: E501 + error_reasons: Optional[List[StrictStr]] = Field(default=None, description="Error message when updating store dine-in hour. `null` indicates no error.", alias="errorReasons") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["errorReasons"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateDineInHourResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if error_reasons (nullable) is None + # and model_fields_set contains the field + if self.error_reasons is None and "error_reasons" in self.model_fields_set: + _dict['errorReasons'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateDineInHourResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "errorReasons": obj.get("errorReasons") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_menu_item.py b/grabfood/models/update_menu_item.py new file mode 100644 index 0000000..29c9ed7 --- /dev/null +++ b/grabfood/models/update_menu_item.py @@ -0,0 +1,149 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.update_advanced_pricing import UpdateAdvancedPricing +from grabfood.models.update_purchasability import UpdatePurchasability +from typing import Optional, Set +from typing_extensions import Self + +class UpdateMenuItem(BaseModel): + """ + Information about the GrabFood client updating their food menu. + """ # noqa: E501 + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + var_field: StrictStr = Field(description="The record type that you want to update.", alias="field") + id: StrictStr = Field(description="The record's ID on the partner system. For example, the item id in case type is ITEM.") + price: Optional[StrictInt] = Field(default=None, description="The record's price in minor unit format.") + available_status: Optional[StrictStr] = Field(default=None, description="The record's availableStatus. Note: In order to set an item as \"UNAVAILABLE\", it is required to update both the `availableStatus` and `maxStock` fields, whereby the `maxStock` value should be set to 0. ", alias="availableStatus") + max_stock: Optional[StrictInt] = Field(default=None, description="Available stocks under inventory for this item. Auto reduce when there is order placed for this item. Note: It is necessary to set `maxStock` to 0 if the `availableStatus` of the item is \"UNAVAILABLE\". Item will be set to \"AVAILABLE\" if `maxStock` > 0. ", alias="maxStock") + advanced_pricings: Optional[List[UpdateAdvancedPricing]] = Field(default=None, description="Price configuration (in minor unit) for different service, order type and channel combination. If a service type does not have a specified price, it will utilize the default price of the item. ", alias="advancedPricings") + purchasabilities: Optional[List[UpdatePurchasability]] = Field(default=None, description="Purchasability is set to true by default for all service type, unless it is explicitly set to false. Modifier will reuse it’s item’s purchasability. ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID", "field", "id", "price", "availableStatus", "maxStock", "advancedPricings", "purchasabilities"] + + @field_validator('var_field') + def var_field_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ITEM']): + raise ValueError("must be one of enum values ('ITEM')") + return value + + @field_validator('available_status') + def available_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AVAILABLE', 'UNAVAILABLE', 'UNAVAILABLETODAY']): + raise ValueError("must be one of enum values ('AVAILABLE', 'UNAVAILABLE', 'UNAVAILABLETODAY')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateMenuItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in advanced_pricings (list) + _items = [] + if self.advanced_pricings: + for _item_advanced_pricings in self.advanced_pricings: + if _item_advanced_pricings: + _items.append(_item_advanced_pricings.to_dict()) + _dict['advancedPricings'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in purchasabilities (list) + _items = [] + if self.purchasabilities: + for _item_purchasabilities in self.purchasabilities: + if _item_purchasabilities: + _items.append(_item_purchasabilities.to_dict()) + _dict['purchasabilities'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateMenuItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID"), + "field": obj.get("field"), + "id": obj.get("id"), + "price": obj.get("price"), + "availableStatus": obj.get("availableStatus"), + "maxStock": obj.get("maxStock"), + "advancedPricings": [UpdateAdvancedPricing.from_dict(_item) for _item in obj["advancedPricings"]] if obj.get("advancedPricings") is not None else None, + "purchasabilities": [UpdatePurchasability.from_dict(_item) for _item in obj["purchasabilities"]] if obj.get("purchasabilities") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_menu_modifier.py b/grabfood/models/update_menu_modifier.py new file mode 100644 index 0000000..eacbb07 --- /dev/null +++ b/grabfood/models/update_menu_modifier.py @@ -0,0 +1,141 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.update_advanced_pricing import UpdateAdvancedPricing +from typing import Optional, Set +from typing_extensions import Self + +class UpdateMenuModifier(BaseModel): + """ + Information about the GrabFood client updating their food menu. + """ # noqa: E501 + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + var_field: StrictStr = Field(description="The record type that you want to update.", alias="field") + id: StrictStr = Field(description="The record's ID on the partner system. For example, the modifier id in case type is MODIFIER.") + price: Optional[StrictInt] = Field(default=None, description="The record's price in minor unit format.") + name: StrictStr = Field(description="**Only required when updating modifiers.** The record's name. Used as identifier to locate the correct record.") + available_status: Optional[StrictStr] = Field(default=None, description="The record's availableStatus.", alias="availableStatus") + is_free: Optional[StrictBool] = Field(default=None, description="Allows the modifier's price to be explicitly set as zero. Possible values are as follows: * `isFree` && `price == 0` sets the modifier's price to zero. * `isFree` && `price > 0` returns an error message that \"price cannot be set to > 0, if modifier is free”. * `!isFree` && `price > 0` sets the modifier's price to the defined price. * `!isFree` && `price == 0` does not update the modifier's price and reuses the existing price. ", alias="isFree") + advanced_pricings: Optional[List[UpdateAdvancedPricing]] = Field(default=None, description="Price configuration (in minor unit) for different service, order type and channel combination. If a service type does not have a specified price, it will utilize the default price of the item. ", alias="advancedPricings") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID", "field", "id", "price", "name", "availableStatus", "isFree", "advancedPricings"] + + @field_validator('var_field') + def var_field_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MODIFIER']): + raise ValueError("must be one of enum values ('MODIFIER')") + return value + + @field_validator('available_status') + def available_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AVAILABLE', 'UNAVAILABLE', 'UNAVAILABLETODAY']): + raise ValueError("must be one of enum values ('AVAILABLE', 'UNAVAILABLE', 'UNAVAILABLETODAY')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateMenuModifier from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in advanced_pricings (list) + _items = [] + if self.advanced_pricings: + for _item_advanced_pricings in self.advanced_pricings: + if _item_advanced_pricings: + _items.append(_item_advanced_pricings.to_dict()) + _dict['advancedPricings'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateMenuModifier from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID"), + "field": obj.get("field"), + "id": obj.get("id"), + "price": obj.get("price"), + "name": obj.get("name"), + "availableStatus": obj.get("availableStatus"), + "isFree": obj.get("isFree"), + "advancedPricings": [UpdateAdvancedPricing.from_dict(_item) for _item in obj["advancedPricings"]] if obj.get("advancedPricings") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_menu_notif_request.py b/grabfood/models/update_menu_notif_request.py new file mode 100644 index 0000000..a04bb82 --- /dev/null +++ b/grabfood/models/update_menu_notif_request.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class UpdateMenuNotifRequest(BaseModel): + """ + This request notifies GrabFood about the partner's updated food menu. + """ # noqa: E501 + merchant_id: StrictStr = Field(description="The merchant's ID that is in GrabFood's database.", alias="merchantID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["merchantID"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateMenuNotifRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateMenuNotifRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "merchantID": obj.get("merchantID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_menu_request.py b/grabfood/models/update_menu_request.py new file mode 100644 index 0000000..b854d59 --- /dev/null +++ b/grabfood/models/update_menu_request.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from grabfood.models.update_menu_item import UpdateMenuItem +from grabfood.models.update_menu_modifier import UpdateMenuModifier +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +UPDATEMENUREQUEST_ONE_OF_SCHEMAS = ["UpdateMenuItem", "UpdateMenuModifier"] + +class UpdateMenuRequest(BaseModel): + """ + UpdateMenuRequest + """ + # data type: UpdateMenuItem + oneof_schema_1_validator: Optional[UpdateMenuItem] = None + # data type: UpdateMenuModifier + oneof_schema_2_validator: Optional[UpdateMenuModifier] = None + actual_instance: Optional[Union[UpdateMenuItem, UpdateMenuModifier]] = None + one_of_schemas: Set[str] = { "UpdateMenuItem", "UpdateMenuModifier" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = UpdateMenuRequest.model_construct() + error_messages = [] + match = 0 + # validate data type: UpdateMenuItem + if not isinstance(v, UpdateMenuItem): + error_messages.append(f"Error! Input type `{type(v)}` is not `UpdateMenuItem`") + else: + match += 1 + # validate data type: UpdateMenuModifier + if not isinstance(v, UpdateMenuModifier): + error_messages.append(f"Error! Input type `{type(v)}` is not `UpdateMenuModifier`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in UpdateMenuRequest with oneOf schemas: UpdateMenuItem, UpdateMenuModifier. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in UpdateMenuRequest with oneOf schemas: UpdateMenuItem, UpdateMenuModifier. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into UpdateMenuItem + try: + instance.actual_instance = UpdateMenuItem.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into UpdateMenuModifier + try: + instance.actual_instance = UpdateMenuModifier.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into UpdateMenuRequest with oneOf schemas: UpdateMenuItem, UpdateMenuModifier. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into UpdateMenuRequest with oneOf schemas: UpdateMenuItem, UpdateMenuModifier. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], UpdateMenuItem, UpdateMenuModifier]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/grabfood/models/update_purchasability.py b/grabfood/models/update_purchasability.py new file mode 100644 index 0000000..64e72ed --- /dev/null +++ b/grabfood/models/update_purchasability.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class UpdatePurchasability(BaseModel): + """ + UpdatePurchasability + """ # noqa: E501 + key: Optional[StrictStr] = Field(default=None, description="Available service type.") + purchasable: Optional[StrictBool] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "purchasable"] + + @field_validator('key') + def key_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Delivery_OnDemand_GrabApp', 'Delivery_Scheduled_GrabApp', 'SelfPickUp_OnDemand_GrabApp', 'DineIn_OnDemand_GrabApp', 'Delivery_OnDemand_StoreFront', 'Delivery_Scheduled_StoreFront', 'SelfPickUp_OnDemand_StoreFront']): + raise ValueError("must be one of enum values ('Delivery_OnDemand_GrabApp', 'Delivery_Scheduled_GrabApp', 'SelfPickUp_OnDemand_GrabApp', 'DineIn_OnDemand_GrabApp', 'Delivery_OnDemand_StoreFront', 'Delivery_Scheduled_StoreFront', 'SelfPickUp_OnDemand_StoreFront')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdatePurchasability from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdatePurchasability from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "purchasable": obj.get("purchasable") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_special_hour_request.py b/grabfood/models/update_special_hour_request.py new file mode 100644 index 0000000..ca6c8f8 --- /dev/null +++ b/grabfood/models/update_special_hour_request.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from grabfood.models.special_opening_hour import SpecialOpeningHour +from typing import Optional, Set +from typing_extensions import Self + +class UpdateSpecialHourRequest(BaseModel): + """ + Object contains store special hours. + """ # noqa: E501 + special_opening_hours: List[SpecialOpeningHour] = Field(description="An array of objects contain store special hours. Max. 3 array elements.", alias="specialOpeningHours") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["specialOpeningHours"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateSpecialHourRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in special_opening_hours (list) + _items = [] + if self.special_opening_hours: + for _item_special_opening_hours in self.special_opening_hours: + if _item_special_opening_hours: + _items.append(_item_special_opening_hours.to_dict()) + _dict['specialOpeningHours'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateSpecialHourRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "specialOpeningHours": [SpecialOpeningHour.from_dict(_item) for _item in obj["specialOpeningHours"]] if obj.get("specialOpeningHours") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/update_special_hour_response.py b/grabfood/models/update_special_hour_response.py new file mode 100644 index 0000000..36cda17 --- /dev/null +++ b/grabfood/models/update_special_hour_response.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class UpdateSpecialHourResponse(BaseModel): + """ + Object contain update store special hour response + """ # noqa: E501 + error_reasons: Optional[List[StrictStr]] = Field(default=None, description="Error message when updating store delivery hour. `null` indicates no error.", alias="errorReasons") + order_count: StrictInt = Field(description="Total active order for the day.", alias="orderCount") + scheduled_order_count: StrictInt = Field(description="Total scheduled order during store close period.", alias="scheduledOrderCount") + close_immediately: StrictBool = Field(description="Indicate the store status after updating special hours.", alias="closeImmediately") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["errorReasons", "orderCount", "scheduledOrderCount", "closeImmediately"] + + @field_validator('error_reasons') + def error_reasons_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['PendingOrders']): + raise ValueError("each list item must be one of ('PendingOrders')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateSpecialHourResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if error_reasons (nullable) is None + # and model_fields_set contains the field + if self.error_reasons is None and "error_reasons" in self.model_fields_set: + _dict['errorReasons'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateSpecialHourResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "errorReasons": obj.get("errorReasons"), + "orderCount": obj.get("orderCount"), + "scheduledOrderCount": obj.get("scheduledOrderCount"), + "closeImmediately": obj.get("closeImmediately") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/voucher.py b/grabfood/models/voucher.py new file mode 100644 index 0000000..94b34ee --- /dev/null +++ b/grabfood/models/voucher.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.voucher_description_info import VoucherDescriptionInfo +from typing import Optional, Set +from typing_extensions import Self + +class Voucher(BaseModel): + """ + A JSON object containing dine-in voucher details. + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="The title of the voucher.") + discounted_price: Optional[StrictStr] = Field(default=None, description="The amount paid after discount is applied in local currency.", alias="discountedPrice") + original_price: Optional[StrictStr] = Field(default=None, description="The original amount before discount is applied in local currency.", alias="originalPrice") + description_info: Optional[VoucherDescriptionInfo] = Field(default=None, alias="descriptionInfo") + voucher_type: Optional[StrictStr] = Field(default=None, description="The type of the dine-in voucher.", alias="voucherType") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "discountedPrice", "originalPrice", "descriptionInfo", "voucherType"] + + @field_validator('voucher_type') + def voucher_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CASH', 'ITEM']): + raise ValueError("must be one of enum values ('CASH', 'ITEM')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Voucher from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of description_info + if self.description_info: + _dict['descriptionInfo'] = self.description_info.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Voucher from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "discountedPrice": obj.get("discountedPrice"), + "originalPrice": obj.get("originalPrice"), + "descriptionInfo": VoucherDescriptionInfo.from_dict(obj["descriptionInfo"]) if obj.get("descriptionInfo") is not None else None, + "voucherType": obj.get("voucherType") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/voucher_description_info.py b/grabfood/models/voucher_description_info.py new file mode 100644 index 0000000..485884d --- /dev/null +++ b/grabfood/models/voucher_description_info.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherDescriptionInfo(BaseModel): + """ + A JSON object containing dine-in voucher's description information. + """ # noqa: E501 + text: Optional[StrictStr] = Field(default=None, description="The description of the dine-in voucher.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["text"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherDescriptionInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherDescriptionInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "text": obj.get("text") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/working_hour.py b/grabfood/models/working_hour.py new file mode 100644 index 0000000..b2b3bc5 --- /dev/null +++ b/grabfood/models/working_hour.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.working_hour_day import WorkingHourDay +from typing import Optional, Set +from typing_extensions import Self + +class WorkingHour(BaseModel): + """ + A JSON object that describes the workingHour for each day. + """ # noqa: E501 + sun: Optional[WorkingHourDay] = None + mon: Optional[WorkingHourDay] = None + tue: Optional[WorkingHourDay] = None + wed: Optional[WorkingHourDay] = None + thu: Optional[WorkingHourDay] = None + fri: Optional[WorkingHourDay] = None + sat: Optional[WorkingHourDay] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkingHour from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of sun + if self.sun: + _dict['sun'] = self.sun.to_dict() + # override the default output from pydantic by calling `to_dict()` of mon + if self.mon: + _dict['mon'] = self.mon.to_dict() + # override the default output from pydantic by calling `to_dict()` of tue + if self.tue: + _dict['tue'] = self.tue.to_dict() + # override the default output from pydantic by calling `to_dict()` of wed + if self.wed: + _dict['wed'] = self.wed.to_dict() + # override the default output from pydantic by calling `to_dict()` of thu + if self.thu: + _dict['thu'] = self.thu.to_dict() + # override the default output from pydantic by calling `to_dict()` of fri + if self.fri: + _dict['fri'] = self.fri.to_dict() + # override the default output from pydantic by calling `to_dict()` of sat + if self.sat: + _dict['sat'] = self.sat.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkingHour from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sun": WorkingHourDay.from_dict(obj["sun"]) if obj.get("sun") is not None else None, + "mon": WorkingHourDay.from_dict(obj["mon"]) if obj.get("mon") is not None else None, + "tue": WorkingHourDay.from_dict(obj["tue"]) if obj.get("tue") is not None else None, + "wed": WorkingHourDay.from_dict(obj["wed"]) if obj.get("wed") is not None else None, + "thu": WorkingHourDay.from_dict(obj["thu"]) if obj.get("thu") is not None else None, + "fri": WorkingHourDay.from_dict(obj["fri"]) if obj.get("fri") is not None else None, + "sat": WorkingHourDay.from_dict(obj["sat"]) if obj.get("sat") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/models/working_hour_day.py b/grabfood/models/working_hour_day.py new file mode 100644 index 0000000..311241c --- /dev/null +++ b/grabfood/models/working_hour_day.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from grabfood.models.open_period import OpenPeriod +from typing import Optional, Set +from typing_extensions import Self + +class WorkingHourDay(BaseModel): + """ + A JSON object for workingHour for a day. + """ # noqa: E501 + periods: Optional[List[OpenPeriod]] = Field(default=None, description="An array of open periods. `null` if the campaign period is closed all day.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["periods"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkingHourDay from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in periods (list) + _items = [] + if self.periods: + for _item_periods in self.periods: + if _item_periods: + _items.append(_item_periods.to_dict()) + _dict['periods'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if periods (nullable) is None + # and model_fields_set contains the field + if self.periods is None and "periods" in self.model_fields_set: + _dict['periods'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkingHourDay from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "periods": [OpenPeriod.from_dict(_item) for _item in obj["periods"]] if obj.get("periods") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/grabfood/py.typed b/grabfood/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/grabfood/rest.py b/grabfood/rest.py new file mode 100644 index 0000000..957326c --- /dev/null +++ b/grabfood/rest.py @@ -0,0 +1,271 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +/* +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 +*/ + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +import io +import json +import re +import ssl + +import urllib3 + +from grabfood.exceptions import ApiException, ApiValueError + +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse + + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status + self.reason = resp.reason + self.data = None + self.raw_data = resp.data + + def read(self): + if self.data is None: + if self.raw_data is not None: + try: + self.data = json.loads(self.raw_data.decode('utf-8')) + except json.JSONDecodeError: + self.data = self.raw_data + else: + try: + self.data = json.loads(self.response.data.decode('utf-8')) + except json.JSONDecodeError: + self.data = self.response.data + return self.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + } + if configuration.assert_hostname is not None: + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) + + if configuration.retries is not None: + pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + pool_args['socket_options'] = configuration.socket_options + + if configuration.connection_pool_maxsize is not None: + pool_args['maxsize'] = configuration.connection_pool_maxsize + + # https pool manager + self.pool_manager: urllib3.PoolManager + + if configuration.proxy: + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) + else: + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): + """Perform requests. + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, float)): + timeout = urllib3.Timeout(total=_request_timeout) + elif ( + isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2 + ): + timeout = urllib3.Timeout( + connect=_request_timeout[0], + read=_request_timeout[1] + ) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + # no content type provided or payload is json + content_type = headers.get('Content-Type') + if ( + not content_type + or re.search('json', content_type, re.IGNORECASE) + ): + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, + url, + body=request_body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'application/x-www-form-urlencoded': + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=False, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + # Ensures that dict objects are serialized + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=True, + timeout=timeout, + headers=headers, + preload_content=False + ) + # Pass a `string` parameter directly in the body to support + # other content types than JSON when `body` argument is + # provided in serialized form. + elif isinstance(body, str) or isinstance(body, bytes): + r = self.pool_manager.request( + method, + url, + body=body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, + url, + body=request_body, + preload_content=False, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request( + method, + url, + fields={}, + timeout=timeout, + headers=headers, + preload_content=False + ) + except urllib3.exceptions.SSLError as e: + msg = "\n".join([type(e).__name__, str(e)]) + raise ApiException(status=0, reason=msg) + + return RESTResponse(r) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..62c4a95 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,71 @@ +[tool.poetry] +name = "grabfood" +version = "1.0.1" +description = "GrabFood" +authors = ["OpenAPI Generator Community "] +license = "NoLicense" +readme = "README.md" +repository = "https://github.com/grab/grabfood-api-sdk-python" +keywords = ["OpenAPI", "OpenAPI-Generator", "GrabFood"] +include = ["grabfood/py.typed"] + +[tool.poetry.dependencies] +python = "^3.7" + +urllib3 = ">= 1.25.3" +python-dateutil = ">=2.8.2" +pydantic = ">=2" +typing-extensions = ">=4.7.1" + +[tool.poetry.dev-dependencies] +pytest = ">=7.2.1" +tox = ">=3.9.0" +flake8 = ">=4.0.0" +types-python-dateutil = ">=2.8.19.14" +mypy = "1.4.1" + + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = [ + "grabfood", + #"test", # auto-generated tests + "tests", # hand-written tests +] +# TODO: enable "strict" once all these individual checks are passing +# strict = true + +# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true + +## Getting these passing should be easy +strict_equality = true +strict_concatenate = true + +## Strongly recommend enabling this one as soon as you can +check_untyped_defs = true + +## These shouldn't be too much additional work, but may be tricky to +## get passing if you use a lot of untyped libraries +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true + +### These next few are various gradations of forcing use of type annotations +#disallow_untyped_calls = true +#disallow_incomplete_defs = true +#disallow_untyped_defs = true +# +### This one isn't too hard to get passing, but return on investment is lower +#no_implicit_reexport = true +# +### This one can be tricky to get passing if you use a lot of untyped libraries +#warn_return_any = true diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..cc85509 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.25.3, < 2.1.0 +pydantic >= 2 +typing-extensions >= 4.7.1 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..11433ee --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..8775009 --- /dev/null +++ b/setup.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +""" +Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved. +Use of this source code is governed by an MIT-style license that can be found in the LICENSE file + +GrabFood + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.1.3 + + Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +""" + + +from setuptools import setup, find_packages # noqa: H301 + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools +NAME = "grabfood" +VERSION = "1.0.1" +PYTHON_REQUIRES = ">=3.7" +REQUIRES = [ + "urllib3 >= 1.25.3, < 2.1.0", + "python-dateutil", + "pydantic >= 2", + "typing-extensions >= 4.7.1", +] + +setup( + name=NAME, + version=VERSION, + description="GrabFood", + author="OpenAPI Generator community", + author_email="team@openapitools.org", + url="", + keywords=["OpenAPI", "OpenAPI-Generator", "GrabFood"], + install_requires=REQUIRES, + packages=find_packages(exclude=["test", "tests"]), + include_package_data=True, + long_description_content_type='text/markdown', + long_description="""\ + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + """, # noqa: E501 + package_data={"grabfood": ["py.typed"]}, +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..8e6d8cb --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,5 @@ +pytest~=7.1.3 +pytest-cov>=2.8.1 +pytest-randomly>=3.12.0 +mypy>=1.4.1 +types-python-dateutil>=2.8.19 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..cdb0416 --- /dev/null +++ b/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov=grabfood