// isValidPost checks to see if a post is valid or not.
// This is all done in accordance with https://developer.linkedin.com/docs/share-on-linkedin
// and is valid as of 2018-01-16
isValidPost checks to see if a post is valid or not.
// isValidPost checks to see if a post is valid or not . // This is all done in accordance with https : // developer . linkedin . com / docs / share - on - linkedin // and is valid as of 2018 - 01 - 16
func isValidPost(post *Post) bool {
	if (post.Visibility.Code != "anyone" && post.Visibility.Code != "connections-only") || len(post.Comment) == 0 {
		return false
	}
	if len(post.Content.Title) > 200 || len(post.Content.Description) > 256 || len(post.Comment) > 700 {
		return false
	}
	if post.Content.SubmittedURL != "" {
		_, err := url.ParseRequestURI(post.Content.SubmittedURL)
		if err != nil {
			return false
		}
	}
	if post.Content.SubmittedImageURL != "" {
		_, err := url.ParseRequestURI(post.Content.SubmittedImageURL)
		if err != nil {
			return false
		}
	}
	return true
}
func isValidPost ( post * Post ) bool { if ( post . Visibility . Code != " " && post . Visibility . Code != " " ) || len ( post . Comment ) == 0 { return false } if len ( post . Content . Title ) > 200 || len ( post . Content . Description ) > 256 || len ( post . Comment ) > 700 { return false } if post . Content . SubmittedURL != " " { _ , err := url . ParseRequestURI ( post . Content . SubmittedURL ) if err != nil { return false } } if post . Content . SubmittedImageURL != " " { _ , err := url . ParseRequestURI ( post . Content . SubmittedImageURL ) if err != nil { return false } } return true }
isValidPost checks to see if a post is valid or not.
isValidPost checks to see if a post is valid or not .
// Validate field essentials. // Check length limits // Check if URLs are FQDN