private bool IsPersonalDocument(PassportElementType type)
 {
     return(type is PassportElementTypeDriverLicense ||
            type is PassportElementTypePassport ||
            type is PassportElementTypeInternalPassport ||
            type is PassportElementTypeIdentityCard);
 }
 /// <summary>
 /// Returns one of the available Telegram Passport elements
 /// </summary>
 public static Task <PassportElement> GetPassportElementAsync(
     this Client client, PassportElementType type = default, string password = default)
 {
     return(client.ExecuteAsync(new GetPassportElement
     {
         Type = type, Password = password
     }));
 }
 private bool IsAddressDocument(PassportElementType type)
 {
     return(type is PassportElementTypeUtilityBill ||
            type is PassportElementTypeBankStatement ||
            type is PassportElementTypePassportRegistration ||
            type is PassportElementTypeTemporaryRegistration ||
            type is PassportElementTypeRentalAgreement);
 }
 /// <summary>
 /// Deletes a Telegram Passport element
 /// </summary>
 public static Task <Ok> DeletePassportElementAsync(
     this Client client, PassportElementType type = default)
 {
     return(client.ExecuteAsync(new DeletePassportElement
     {
         Type = type
     }));
 }
 private String getNameForType(PassportElementType type)
 {
     if (type is PassportElementTypePersonalDetails)
     {
         return("personal_details");
     }
     else if (type is PassportElementTypePassport)
     {
         return("passport");
     }
     else if (type is PassportElementTypeInternalPassport)
     {
         return("internal_passport");
     }
     else if (type is PassportElementTypeDriverLicense)
     {
         return("driver_license");
     }
     else if (type is PassportElementTypeIdentityCard)
     {
         return("identity_card");
     }
     else if (type is PassportElementTypeUtilityBill)
     {
         return("utility_bill");
     }
     else if (type is PassportElementTypeAddress)
     {
         return("address");
     }
     else if (type is PassportElementTypeBankStatement)
     {
         return("bank_statement");
     }
     else if (type is PassportElementTypeRentalAgreement)
     {
         return("rental_agreement");
     }
     else if (type is PassportElementTypeTemporaryRegistration)
     {
         return("temporary_registration");
     }
     else if (type is PassportElementTypePassportRegistration)
     {
         return("passport_registration");
     }
     else if (type is PassportElementTypeEmailAddress)
     {
         return("email");
     }
     else if (type is PassportElementTypePhoneNumber)
     {
         return("phone");
     }
     return("");
 }
Beispiel #6
0
        private string GetTextForType(PassportElementType type)
        {
            switch (type)
            {
            case PassportElementTypePassport passport:
                return(Strings.Resources.ActionBotDocumentPassport);

            case PassportElementTypeDriverLicense driverLicense:
                return(Strings.Resources.ActionBotDocumentDriverLicence);

            case PassportElementTypeIdentityCard identityCard:
                return(Strings.Resources.ActionBotDocumentIdentityCard);

            case PassportElementTypeUtilityBill utilityBill:
                return(Strings.Resources.ActionBotDocumentUtilityBill);

            case PassportElementTypeBankStatement bankStatement:
                return(Strings.Resources.ActionBotDocumentBankStatement);

            case PassportElementTypeRentalAgreement rentalAgreement:
                return(Strings.Resources.ActionBotDocumentRentalAgreement);

            case PassportElementTypeInternalPassport internalPassport:
                return(Strings.Resources.ActionBotDocumentInternalPassport);

            case PassportElementTypePassportRegistration passportRegistration:
                return(Strings.Resources.ActionBotDocumentPassportRegistration);

            case PassportElementTypeTemporaryRegistration temporaryRegistration:
                return(Strings.Resources.ActionBotDocumentTemporaryRegistration);

            case PassportElementTypePhoneNumber phoneNumber:
                return(Strings.Resources.ActionBotDocumentPhone);

            case PassportElementTypeEmailAddress emailAddress:
                return(Strings.Resources.ActionBotDocumentEmail);

            default:
                return(null);
            }
        }