From d14e4ef62e45b3e2c7f3ecbdd5683e69db19d541 Mon Sep 17 00:00:00 2001 From: Adlet Zeineken Date: Fri, 10 Jan 2025 03:19:29 -0800 Subject: [PATCH] Move thrift case creation from fbcode/thrift to fbcode/care_platfrom/thrift Summary: Files in fbcode/thrift are being synced to open source hhvm library in github. Thus, our internal thrift case creation files were published there. For avoiding this issue, moved all of the related files to fbcode/care_platform/thrift. Reviewed By: vitaut Differential Revision: D67972707 fbshipit-source-id: afb4ac363186d98f8b02c24cd8a4c08999e222b2 --- .../care_platform_client.py | 47 --------- ...sforce_case_with_mail_draft_service.thrift | 98 ------------------- 2 files changed, 145 deletions(-) delete mode 100644 thrift/care_platform_client/care_platform_client.py delete mode 100644 thrift/care_platform_client/if/create_salesforce_case_with_mail/create_salesforce_case_with_mail_draft_service.thrift diff --git a/thrift/care_platform_client/care_platform_client.py b/thrift/care_platform_client/care_platform_client.py deleted file mode 100644 index 5f6062c07b5..00000000000 --- a/thrift/care_platform_client/care_platform_client.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# pyre-ignore-all-errors - -from create_salesforce_case_with_mail.create_salesforce_case_with_mail_draft_service.thrift_clients import ( - CreateSalesforceCaseWithMailDraftService, -) -from create_salesforce_case_with_mail.create_salesforce_case_with_mail_draft_service.thrift_types import ( - CreateSalesforceCaseWithMailDraftRequest, - CreateSalesforceCaseWithMailDraftResponse_Thrift, -) -from gatekeeper.py.gk import GK -from libfb.py import employee -from monitoring.obc.py import OBCClient -from servicerouter.python.sync_client import get_sr_client - -GK_NAME = "care_platform_fbcode_thrift_case_creation_service" -TIER_NAME = "care_platform.create_case_with_mail_for_bse.fbcode_www_thrift_service" -ODS_COUNTER_ENTITY = "care_platform.thrift_case_creation_with_mail_draft" -ODS_RECEIVED_KEY = "care_platform.thrift_case_creation_with_mail_draft.received" -ODS_SUCCESS_KEY = "care_platform.thrift_case_creation_with_mail_draft.success" - - -def create_case_with_mail(request: CreateSalesforceCaseWithMailDraftRequest): - ods_client = OBCClient.OBCClient("default") - ods_client.bumpEntityKey(ODS_COUNTER_ENTITY, ODS_RECEIVED_KEY) - if GK.check(GK_NAME, employee.get_current_unix_user_fbid()): - with get_sr_client( - CreateSalesforceCaseWithMailDraftService, - tier=TIER_NAME, - ) as client: - ods_client.bumpEntityKey(ODS_COUNTER_ENTITY, ODS_SUCCESS_KEY) - return client.genCreateSalesforceCaseWithMailDraft(request) - else: - return CreateSalesforceCaseWithMailDraftResponse_Thrift() diff --git a/thrift/care_platform_client/if/create_salesforce_case_with_mail/create_salesforce_case_with_mail_draft_service.thrift b/thrift/care_platform_client/if/create_salesforce_case_with_mail/create_salesforce_case_with_mail_draft_service.thrift deleted file mode 100644 index efa6d99aee2..00000000000 --- a/thrift/care_platform_client/if/create_salesforce_case_with_mail/create_salesforce_case_with_mail_draft_service.thrift +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace py3 create_salesforce_case_with_mail - -# Response -struct CreateSalesforceCaseWithMailDraftResponse_Thrift { - 1: optional string case_id; - 2: optional string case_number; - 3: string reference_id; -} - -# Request -struct CareContactInfo { - 1: string email; - 2: string full_name; - 3: optional string encrypted_user_id; - 4: optional string encrypted_datr; - 5: optional string phone_number; -} - -union MixedValue { - 1: string string_value; - 2: i32 int_value; - 3: double double_value; - 4: bool bool_value; -} - -enum CareCasePriority { - HIGH = 0, - LOW = 1, -} - -enum CaseVisibility { - PRIVATE = 0, - PUBLIC = 1, -} - -struct Info { - 1: CareContactInfo contact_info; - 2: string subject; - 3: string description; - 4: optional map additional_info; - 5: optional string locale; - 6: optional string case_channel; - 7: optional CareCasePriority care_priority; - 8: optional string external_case_id; - 9: optional string customer_internal_id; - 10: optional string case_owner_id; - 11: optional CaseVisibility case_visibility; - 12: optional string customer_id; - 13: optional string person_regarding_employee_id; - 14: bool async_response; - 15: optional string partner_vertical; -} - -struct SubscribersInfo { - 1: string employee_id; - 2: string email_id; -} - -struct EmailMessageInfo { - 1: optional string from_email_id; - 2: optional list cc_email_ids; - 3: optional list to_email_ids; - 4: optional list bcc_email_ids; - 5: optional string subject; - 6: optional string body; - 7: optional string email_status; -} - -struct CreateSalesforceCaseWithMailDraftRequest { - 1: optional string session_id; - 2: Info info; - 3: string case_intake_classification_key; - 4: optional bool dry_run; - 5: optional list subscribers; - 6: optional EmailMessageInfo email_message_info; -} - -service CreateSalesforceCaseWithMailDraftService { - CreateSalesforceCaseWithMailDraftResponse_Thrift genCreateSalesforceCaseWithMailDraft( - 1: CreateSalesforceCaseWithMailDraftRequest request, - ); -}