import { ISocialFeed } from "../../@types/lib" ; import { ITargetInfoProps } from "../../@types/utils" ; import { Base , Request , RequestType } from "../utils" ; /**
 * Social Feed
 */ export const SocialFeed = ( ( targetInfo ? ) => { let base = new Base ( targetInfo ) ; let socialFeed = base as any as ISocialFeed ; base . targetInfo . defaultToWebFl = true ; base . targetInfo . endpoint = "social.feed" ; Request . addMethods ( socialFeed as any , { __metadata : { type : "SP.Social.SocialRestFeedManager" } } ) ; return socialFeed ; } ) as any ; SocialFeed . postToFeed = ( accountName , creationData ) => { let postInfo = { ID : null , creationData : creationData } ; postInfo [ "__metadata" ] = { type : "SP.Social.SocialRestPostCreationData" } ; postInfo . creationData [ "__metadata" ] = { type : "SP.Social.SocialPostCreationData" } ; return SocialFeed ( ) . executeMethod ( "postToMyFeed" , { argNames : [ "restCreationData" ] , name : "actor(item=@v)/feed?@v='" + encodeURIComponent ( accountName ) + "'" , requestType : RequestType . PostWithArgsInBody } , [ postInfo ] ) ; } ; SocialFeed . postToMyFeed = ( creationData ) => { let postInfo = { ID : null , creationData : creationData } ; postInfo [ "__metadata" ] = { type : "SP.Social.SocialRestPostCreationData" } ; postInfo . creationData [ "__metadata" ] = { type : "SP.Social.SocialPostCreationData" } ; return SocialFeed ( ) . executeMethod ( "postToMyFeed" , { argNames : [ "restCreationData" ] , name : "my/feed/post" , requestType : RequestType . PostWithArgsInBody } , [ postInfo ] ) ; } ;