示例#1
0
        public static ofRecipient FindOrCreate(this ofRecipientService recipientService, string phoneNumber, ofRecipientsCreateOptions createOptions, ofRequestOptions requestOptions = null)
        {
            ofRecipient recipient = new ofRecipient();
            try
            {
                recipient = recipientService.FindByPhone(phoneNumber, requestOptions);
            }
            catch (ofException ex)
            {
                if (ex.Error.ErrorCode == "ResourceNotFound")
                {
                    recipient = recipientService.Create(createOptions, requestOptions);
                    return recipient;
                }
                throw ex;
            }

            return recipient;
        }
示例#2
0
        public static ofRecipient FindOrCreate(this ofRecipientService recipientService, string phoneNumber, ofRecipientsCreateOptions createOptions, ofRequestOptions requestOptions = null)
        {
            ofRecipient recipient = new ofRecipient();

            try
            {
                recipient = recipientService.FindByPhone(phoneNumber, requestOptions);
            }
            catch (ofException ex)
            {
                if (ex.Error.ErrorCode == "ResourceNotFound")
                {
                    recipient = recipientService.Create(createOptions, requestOptions);
                    return(recipient);
                }
                throw ex;
            }


            return(recipient);
        }