vcard

package module
v0.0.0-...-ba79678 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

README

vcard

This is a light weight implementation of VCard v4 to allow harvesting data from our public directory. Currently we're interested in full name (FN), title (TITLE) and organization (ORG) fields.

Documentation

Overview

vcard package is a light weight implementation of the VCard v4 spec implemented to make it easy to harvest our public directory.

@author R. S. Doiel, <rsdoiel@caltech.edu>

Copyright (c) 2017, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

View Source
const (
	Version = `v0.0.1`
	CRLF    = "\r\n"
	LF      = "\n"
	CR      = "\r"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type VCard

type VCard struct {
	Version      string   `json:"version"`
	Name         []string `json:"name"`
	FullName     string   `json:"full_name"`
	Organization []string `json:"organization,omitempty"`
	Title        string   `json:"title,omitempty"`
	EMail        []string `json:"email,omitempty"`
	Telephone    []string `json:"telephone,omitempty"`
	Source       string   `json:"source"`
	Revision     string   `json:"revision"`
}

VCard is a struct based on VCard V4.0 example

func NewVCard

func NewVCard() *VCard

NewVCard creates a new vcard

func (*VCard) AsJSON

func (vcf *VCard) AsJSON() ([]byte, error)

AsJSON takes a vcard and returns it as a JSON doc suitable for using with datatools or dataset

func (*VCard) Parse

func (vcard *VCard) Parse(src []byte) error

Parse takes source of a vcard as a byte array and populates the struct with what it finds.

func (*VCard) String

func (vcf *VCard) String() string

String renders a text view of vcard contents (should really render in VCard v4 format...)

Directories

Path Synopsis
cmd
vcard2json command
vcard2json - converts a single VCard version4.0 to a JSON document @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2018, Caltech All rights not granted herein are expressly reserved by Caltech.
vcard2json - converts a single VCard version4.0 to a JSON document @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2018, Caltech All rights not granted herein are expressly reserved by Caltech.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL