/// <summary>
        /// Convert all Alexa specific attachments to their correct type.
        /// </summary>
        /// <param name="activity"></param>
        public static void ConvertAttachmentContent(this Activity activity)
        {
            if (activity == null || activity.Attachments == null)
            {
                return;
            }

            foreach (var attachment in activity.Attachments)
            {
                switch (attachment.ContentType)
                {
                case HeroCard.ContentType:
                    SharedAttachmentHelper.Convert <HeroCard>(attachment);
                    break;

                case SigninCard.ContentType:
                    SharedAttachmentHelper.Convert <SigninCard>(attachment);
                    break;

                case AlexaAttachmentContentTypes.Card:
                    SharedAttachmentHelper.Convert <ICard>(attachment);
                    break;

                case AlexaAttachmentContentTypes.Directive:
                    SharedAttachmentHelper.Convert <IDirective>(attachment);
                    break;
                }
            }
        }
Beispiel #2
0
        public static Attachment ToAttachment(this SystemIntent intent)
        {
            switch (intent)
            {
            case CarouselIntent carouselIntent:
                return(SharedAttachmentHelper.CreateAttachment(carouselIntent, GoogleAttachmentContentTypes.CarouselIntent));

            case ListIntent listIntent:
                return(SharedAttachmentHelper.CreateAttachment(listIntent, GoogleAttachmentContentTypes.ListIntent));

            case ConfirmationIntent confirmationIntent:
                return(SharedAttachmentHelper.CreateAttachment(confirmationIntent, GoogleAttachmentContentTypes.ConfirmationIntent));

            case DateTimeIntent dateTimeIntent:
                return(SharedAttachmentHelper.CreateAttachment(dateTimeIntent, GoogleAttachmentContentTypes.DateTimeIntent));

            case PermissionsIntent permissionsIntent:
                return(SharedAttachmentHelper.CreateAttachment(permissionsIntent, GoogleAttachmentContentTypes.PermissionsIntent));

            case PlaceLocationIntent placeLocationIntent:
                return(SharedAttachmentHelper.CreateAttachment(placeLocationIntent, GoogleAttachmentContentTypes.PlaceLocationIntent));

            case NewSurfaceIntent newSurfaceIntent:
                return(SharedAttachmentHelper.CreateAttachment(newSurfaceIntent, GoogleAttachmentContentTypes.NewSurfaceIntent));

            default:
                return(null);
            }
        }
Beispiel #3
0
        public static void ConvertAttachmentContent(this Activity activity)
        {
            if (activity == null || activity.Attachments == null)
            {
                return;
            }

            foreach (var attachment in activity.Attachments)
            {
                switch (attachment.ContentType)
                {
                case ZoomAttachmentContentTypes.MessageWithLink:
                    SharedAttachmentHelper.Convert <MessageBodyItemWithLink>(attachment);
                    break;

                case ZoomAttachmentContentTypes.Fields:
                    SharedAttachmentHelper.Convert <FieldsBodyItem>(attachment);
                    break;

                case ZoomAttachmentContentTypes.Dropdown:
                    SharedAttachmentHelper.Convert <DropdownBodyItem>(attachment);
                    break;

                case ZoomAttachmentContentTypes.Attachment:
                    SharedAttachmentHelper.Convert <AttachmentBodyItem>(attachment);
                    break;
                }
            }
        }
Beispiel #4
0
        public static Attachment ToAttachment(this ResponseItem responseItem)
        {
            switch (responseItem)
            {
            case TableCard tableCard:
                return(SharedAttachmentHelper.CreateAttachment(tableCard, GoogleAttachmentContentTypes.TableCard));

            case MediaResponse mediaResponse:
                return(SharedAttachmentHelper.CreateAttachment(mediaResponse, GoogleAttachmentContentTypes.MediaResponse));

            case BasicCard basicCard:
                return(SharedAttachmentHelper.CreateAttachment(basicCard, GoogleAttachmentContentTypes.BasicCard));

            case BrowsingCarousel browsingCarousel:
                return(SharedAttachmentHelper.CreateAttachment(browsingCarousel, GoogleAttachmentContentTypes.BrowsingCarousel));

            default:
                return(null);
            }
        }
Beispiel #5
0
        public static Attachment ToAttachment(this Suggestion responseItem)
        {
            switch (responseItem)
            {
            case OpenUrlActionSuggestion openUrlSuggestedAction:
                return(SharedAttachmentHelper.CreateAttachment(openUrlSuggestedAction, GoogleAttachmentContentTypes.OpenUrlActionSuggestion));

            case DialActionSuggestion dialSuggestedAction:
                return(SharedAttachmentHelper.CreateAttachment(dialSuggestedAction, GoogleAttachmentContentTypes.DialActionSuggestion));

            case LiveAgentRequestSuggestion liveAgentRequestSuggestion:
                return(SharedAttachmentHelper.CreateAttachment(liveAgentRequestSuggestion, GoogleAttachmentContentTypes.LiveAgentRequestSuggestion));

            case AuthenticationRequestSuggestion authenticationRequestSuggestion:
                return(SharedAttachmentHelper.CreateAttachment(authenticationRequestSuggestion, GoogleAttachmentContentTypes.AuthenticationRequestSuggestion));

            default:
                return(null);
            }
        }
        /// <summary>
        /// Convert all Actions SDK specific attachments to their correct type.
        /// </summary>
        /// <param name="activity"></param>
        public static void ConvertAttachmentContent(this Activity activity)
        {
            if (activity == null || activity.Attachments == null)
            {
                return;
            }

            foreach (var attachment in activity.Attachments)
            {
                switch (attachment.ContentType)
                {
                case HeroCard.ContentType:
                    SharedAttachmentHelper.Convert <HeroCard>(attachment);
                    break;

                case SigninCard.ContentType:
                    SharedAttachmentHelper.Convert <SigninCard>(attachment);
                    break;

                case ActionsSdkAttachmentContentTypes.Card:
                    SharedAttachmentHelper.Convert <CardContentItem>(attachment);
                    break;

                case ActionsSdkAttachmentContentTypes.Table:
                    SharedAttachmentHelper.Convert <TableContentItem>(attachment);
                    break;

                case ActionsSdkAttachmentContentTypes.Media:
                    SharedAttachmentHelper.Convert <MediaContentItem>(attachment);
                    break;

                case ActionsSdkAttachmentContentTypes.Collection:
                    SharedAttachmentHelper.Convert <CollectionContentItem>(attachment);
                    break;

                case ActionsSdkAttachmentContentTypes.List:
                    SharedAttachmentHelper.Convert <ListContentItem>(attachment);
                    break;
                }
            }
        }
        public static Attachment ToAttachment(this ContentItem responseItem)
        {
            switch (responseItem)
            {
            case TableContentItem table:
                return(SharedAttachmentHelper.CreateAttachment(table, ActionsSdkAttachmentContentTypes.Table));

            case MediaContentItem media:
                return(SharedAttachmentHelper.CreateAttachment(media, ActionsSdkAttachmentContentTypes.Media));

            case CardContentItem card:
                return(SharedAttachmentHelper.CreateAttachment(card, ActionsSdkAttachmentContentTypes.Card));

            case ListContentItem list:
                return(SharedAttachmentHelper.CreateAttachment(list, ActionsSdkAttachmentContentTypes.List));

            case CollectionContentItem collection:
                return(SharedAttachmentHelper.CreateAttachment(collection, ActionsSdkAttachmentContentTypes.Collection));

            default:
                return(null);
            }
        }
Beispiel #8
0
 public static Attachment ToAttachment(this ICard card)
 {
     return(SharedAttachmentHelper.CreateAttachment(card, AlexaAttachmentContentTypes.Card));
 }
Beispiel #9
0
 public static Attachment ToAttachment(this IDirective directive)
 {
     return(SharedAttachmentHelper.CreateAttachment(directive, AlexaAttachmentContentTypes.Directive));
 }
Beispiel #10
0
        /// <summary>
        /// Convert all Google specific attachments to their correct type.
        /// </summary>
        /// <param name="activity"></param>
        public static void ConvertAttachmentContent(this Activity activity)
        {
            if (activity == null || activity.Attachments == null)
            {
                return;
            }

            foreach (var attachment in activity.Attachments)
            {
                switch (attachment.ContentType)
                {
                case HeroCard.ContentType:
                    SharedAttachmentHelper.Convert <HeroCard>(attachment);
                    break;

                case SigninCard.ContentType:
                    SharedAttachmentHelper.Convert <SigninCard>(attachment);
                    break;

                case GoogleAttachmentContentTypes.BasicCard:
                    SharedAttachmentHelper.Convert <BasicCard>(attachment);
                    break;

                case GoogleAttachmentContentTypes.MediaResponse:
                    SharedAttachmentHelper.Convert <MediaResponse>(attachment);
                    break;

                case GoogleAttachmentContentTypes.TableCard:
                    SharedAttachmentHelper.Convert <TableCard>(attachment);
                    break;

                case GoogleAttachmentContentTypes.BrowsingCarousel:
                    SharedAttachmentHelper.Convert <BrowsingCarousel>(attachment);
                    break;

                case GoogleAttachmentContentTypes.CarouselIntent:
                    SharedAttachmentHelper.Convert <CarouselIntent>(attachment);
                    break;

                case GoogleAttachmentContentTypes.ListIntent:
                    SharedAttachmentHelper.Convert <ListIntent>(attachment);
                    break;

                case GoogleAttachmentContentTypes.DateTimeIntent:
                    SharedAttachmentHelper.Convert <DateTimeIntent>(attachment);
                    break;

                case GoogleAttachmentContentTypes.PermissionsIntent:
                    SharedAttachmentHelper.Convert <PermissionsIntent>(attachment);
                    break;

                case GoogleAttachmentContentTypes.PlaceLocationIntent:
                    SharedAttachmentHelper.Convert <PlaceLocationIntent>(attachment);
                    break;

                case GoogleAttachmentContentTypes.ConfirmationIntent:
                    SharedAttachmentHelper.Convert <ConfirmationIntent>(attachment);
                    break;

                case GoogleAttachmentContentTypes.NewSurfaceIntent:
                    SharedAttachmentHelper.Convert <NewSurfaceIntent>(attachment);
                    break;

                case GoogleAttachmentContentTypes.SigninIntent:
                    SharedAttachmentHelper.Convert <SigninIntent>(attachment);
                    break;
                }
            }
        }
Beispiel #11
0
 public static Attachment ToAttachment(this Image image)
 {
     return(SharedAttachmentHelper.CreateAttachment(image, GoogleAttachmentContentTypes.Image));
 }
Beispiel #12
0
 public static Attachment ToAttachment(this RichCardContent richCardContent)
 {
     return(SharedAttachmentHelper.CreateAttachment(richCardContent, GoogleAttachmentContentTypes.RichCard));
 }