ciscospark

package
v0.0.0-...-1144d74 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int32 value to store v and returns a pointer to it, but unlike Int32 its argument value is an int.

func StreamToString

func StreamToString(stream io.Reader) string

StreamToString converts a reader to a string

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Stringify

func Stringify(message interface{}) string

Stringify attempts to create a string representation of Cisco APIC-EM types

Types

type Client

type Client struct {

	// Base URL for API requests.
	BaseURL *url.URL

	// User agent for client
	UserAgent string

	// Authorization is the authentication token
	Authorization string

	// Services used for communicating with the APIC-EM API
	Memberships     *MembershipsService
	Messages        *MessagesService
	People          *PeopleService
	Rooms           *RoomsService
	TeamMemberships *TeamMembershipsService
	Teams           *TeamsService
	Webhooks        *WebhooksService
	Organizations   *OrganizationsService
	Licenses        *LicensesService
	Roles           *RolesService
	// contains filtered or unexported fields
}

Client manages communication with Cisco Spark V1 API.

func New

func New(httpClient *http.Client, opts ...ClientOpt) (*Client, error)

New returns a new Cisco Spark API client instance.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new Cisco Spark API client.

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body.

func (*Client) OnRequestCompleted

func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)

OnRequestCompleted sets the Cisco Spark API request completion callback

type ClientOpt

type ClientOpt func(*Client) error

ClientOpt are options for New.

func SetBaseURL

func SetBaseURL(bu string) ClientOpt

SetBaseURL is a client option for setting the base URL.

func SetUserAgent

func SetUserAgent(ua string) ClientOpt

SetUserAgent is a client option for setting the user agent.

type ErrorResponse

type ErrorResponse struct {
	// HTTP response that caused this error
	HTTPResponse *http.Response

	Message string
	Errors  []struct {
		Description string
	}
	TrackingID string
}

An ErrorResponse reports the error caused by an API request

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type GetLicensesQueryParams

type GetLicensesQueryParams struct {
	Max   int    `url:"max,omitempty"`
	OrgID string `url:"orgId,omitempty"`
}

GetLicensesQueryParams ...

type GetOrganizationsQueryParams

type GetOrganizationsQueryParams struct {
	Max int `url:"max,omitempty"`
}

GetOrganizationsQueryParams ...

type GetPeopleQueryParams

type GetPeopleQueryParams struct {
	Email       string `url:"email,omitempty"`
	DisplayName string `url:"displayName,omitempty"`
	Max         int    `url:"max,omitempty"`
}

GetPeopleQueryParams ...

type GetRolesQueryParams

type GetRolesQueryParams struct {
	Max int `url:"max,omitempty"`
}

GetRolesQueryParams ...

type License

type License struct {
	ID            string `json:"id,omitempty"`
	Name          string `json:"name,omitempty"`
	TotalUnits    int    `json:"totalUnits,omitempty"`
	ConsumedUnits int    `json:"consumedUnits,omitempty"`
}

License represents the Spark Licenses

func (License) String

func (r License) String() string

type LicensesRoot

type LicensesRoot struct {
	Licenses []*License `json:"items"`
}

type LicensesService

type LicensesService service

LicensesService is an interface for interfacing with the Licenses endpoints of the Cisco Spark API

func (*LicensesService) Get

func (s *LicensesService) Get(queryParams *GetLicensesQueryParams) ([]*License, *Response, error)

Get ....

func (*LicensesService) GetLicense

func (s *LicensesService) GetLicense(LicenseID string) (*License, *Response, error)

GetLicense ....

type ListOptions

type ListOptions struct {
	// For paginated result sets, page of results to retrieve.
	Page int `url:"page,omitempty"`

	// For paginated result sets, the number of results to include per page.
	PerPage int `url:"per_page,omitempty"`
}

ListOptions specifies the optional parameters to various List methods that support pagination.

type Membership

type Membership struct {
	ID          string `json:"id,omitempty"`
	RoomID      string `json:"roomId,omitempty"`
	PersonID    string `json:"personId,omitempty"`
	PersonEmail string `json:"personEmail,omitempty"`
	Created     string `json:"created,omitempty"`
	IsModerator bool   `json:"isModerator,omitempty"`
	IsMonitor   bool   `json:"isMonitor,omitempty"`
}

Membership ...

func (Membership) String

func (r Membership) String() string

type MembershipQueryParams

type MembershipQueryParams struct {
	RoomID      string `url:"roomId,omitempty"`
	PersonID    string `url:"personId,omitempty"`
	PersonEmail string `url:"personEmail,omitempty"`
	Max         int    `url:"max,omitempty"`
}

MembershipQueryParams ...

type MembershipRequest

type MembershipRequest struct {
	RoomID      string `json:"roomId,omitempty"`
	PersonID    string `json:"personId,omitempty"`
	PersonEmail string `json:"personEmail,omitempty"`
	IsModerator bool   `json:"isModerator,omitempty"`
}

MembershipRequest represents the Spark memberships

func (MembershipRequest) String

func (r MembershipRequest) String() string

type MembershipsService

type MembershipsService service

MembershipsService handles communication with the Memberships related methods of the Cisco Spark API.

func (*MembershipsService) DeleteMembership

func (s *MembershipsService) DeleteMembership(membershipID string) (*Response, error)

DeleteMembership ....

func (*MembershipsService) Get

func (s *MembershipsService) Get(queryParams *MembershipQueryParams) ([]*Membership, *Response, error)

Get ....

func (*MembershipsService) GetMembership

func (s *MembershipsService) GetMembership(membershipID string) (*Membership, *Response, error)

GetMembership ....

func (*MembershipsService) Post

func (s *MembershipsService) Post(membershipRequest *MembershipRequest) (*Membership, *Response, error)

Post ....

func (*MembershipsService) UpdateMembership

func (s *MembershipsService) UpdateMembership(membershipID string, updateMembershipRequest *UpdateMembershipRequest) (*Membership, *Response, error)

UpdateMembership ....

type Message

type Message struct {
	ID              string   `json:"id,omitempty"`
	RoomID          string   `json:"roomId,omitempty"`
	ToPersonEmail   string   `json:"toPersonEmail,omitempty"`
	ToPersonID      string   `json:"toPersonId,omitempty"`
	Text            string   `json:"text,omitempty"`
	PersonID        string   `json:"personId,omitempty"`
	PersonEmail     string   `json:"personEmail,omitempty"`
	Created         string   `json:"created,omitempty"`
	MarkDown        string   `json:"markdown,omitempty"`
	Files           []string `json:"files,omitempty"`
	RoomType        string   `json:"roomType,omitempty"`
	MentionedPeople []string `json:"mentionedPeople,omitempty"`
}

Message ...

func (Message) String

func (r Message) String() string

type MessageQueryParams

type MessageQueryParams struct {
	RoomID          string `url:"roomId,omitempty"`
	Before          string `url:"before,omitempty"`
	BeforeMessage   string `url:"beforeMessage,omitempty"`
	Max             int    `url:"max,omitempty"`
	MentionedPeople string `url:"mentionedPeople,omitempty"`
}

MessageQueryParams ...

type MessageRequest

type MessageRequest struct {
	RoomID        string   `json:"roomId,omitempty"`
	Text          string   `json:"text,omitempty"`
	Files         []string `json:"files,omitempty"`
	ToPersonID    string   `json:"toPersonId,omitempty"`
	ToPersonEmail string   `json:"toPersonEmail,omitempty"`
	MarkDown      string   `json:"markdown,omitempty"`
}

MessageRequest represents the Spark messages

func (MessageRequest) String

func (r MessageRequest) String() string

type MessagesService

type MessagesService service

MessagesService handles communication with the Messages related methods of the Cisco Spark API.

func (*MessagesService) DeleteMessage

func (s *MessagesService) DeleteMessage(messageID string) (*Response, error)

DeleteMessage ....

func (*MessagesService) Get

func (s *MessagesService) Get(queryParams *MessageQueryParams) ([]*Message, *Response, error)

Get ....

func (*MessagesService) GetMessage

func (s *MessagesService) GetMessage(messageID string) (*Message, *Response, error)

GetMessage ....

func (*MessagesService) Post

func (s *MessagesService) Post(messageRequest *MessageRequest) (*Message, *Response, error)

Post ....

type Organization

type Organization struct {
	ID          string `json:"id,omitempty"`
	DisplayName string `json:"displayName,omitempty"`
	Created     string `json:"created,omitempty"`
}

Organization represents the Spark organizations

func (Organization) String

func (r Organization) String() string

type OrganizationsService

type OrganizationsService service

organizationsService is an interface for interfacing with the organizations endpoints of the Cisco Spark API

func (*OrganizationsService) Get

Get ....

func (*OrganizationsService) GetOrganization

func (s *OrganizationsService) GetOrganization(OrganizationID string) (*Organization, *Response, error)

GetOrganization ....

type PeopleService

type PeopleService service

PeopleService is an interface for interfacing with the People endpoints of the Cisco Spark API

func (*PeopleService) Get

func (s *PeopleService) Get(queryParams *GetPeopleQueryParams) ([]*Person, *Response, error)

Get ....

func (*PeopleService) GetMe

func (s *PeopleService) GetMe() (*Person, *Response, error)

GetMe ....

func (*PeopleService) GetPerson

func (s *PeopleService) GetPerson(personID string) (*Person, *Response, error)

GetPerson ....

type Person

type Person struct {
	ID          string   `json:"id,omitempty"`
	Emails      []string `json:"emails,omitempty"`
	DisplayName string   `json:"displayName,omitempty"`
	FirstName   string   `json:"firstName,omitempty"`
	LastName    string   `json:"lastName,omitempty"`
	Avatar      string   `json:"avatar,omitempty"`
	Created     string   `json:"created,omitempty"`
	OrgID       string   `json:"orgId,omitempty"`
	Roles       []string `json:"roles,omitempty"`
	Licenses    []string `json:"licenses,omitempty"`
	TimeZone    string   `json:"timezone,omitempty"`
	Status      string   `json:"status,omitempty"`
	NickName    string   `json:"nickName,omitempty"`
	Type        string   `json:"type,omitempty"`
}

Person represents the Spark people

func (Person) String

func (r Person) String() string

type RequestCompletionCallback

type RequestCompletionCallback func(*http.Request, *http.Response)

RequestCompletionCallback defines the type of the request callback function

type Response

type Response struct {
	*http.Response

	// Monitoring URI
	Monitor string
}

Response is a Cisco Spark response. This wraps the standard http.Response returned from Cisco Spark.

type Role

type Role struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

Role represents the Spark roles

func (Role) String

func (r Role) String() string

type RolesService

type RolesService service

rolesService is an interface for interfacing with the roles endpoints of the Cisco Spark API

func (*RolesService) Get

func (s *RolesService) Get(queryParams *GetRolesQueryParams) ([]*Role, *Response, error)

Get ....

func (*RolesService) GetRole

func (s *RolesService) GetRole(RoleID string) (*Role, *Response, error)

GetRole ....

type Room

type Room struct {
	ID           string `json:"id,omitempty"`
	Title        string `json:"title,omitempty"`
	Type         string `json:"type,omitempty"`
	IsLocked     bool   `json:"isLocked,omitempty"`
	TeamID       string `json:"teamId,omitempty"`
	LastActivity string `json:"lastActivity,omitempty"`
	Created      string `json:"created,omitempty"`
}

Room ...

func (Room) String

func (r Room) String() string

type RoomQueryParams

type RoomQueryParams struct {
	Max    int    `url:"max,omitempty"`
	TeamID string `url:"teamId,omitempty"`
	Type   string `url:"type,omitempty"`
}

RoomQueryParams ...

type RoomRequest

type RoomRequest struct {
	TeamID string `json:"teamId,omitempty"`
	Title  string `json:"title,omitempty"`
}

RoomRequest represents the Spark rooms

func (RoomRequest) String

func (r RoomRequest) String() string

type RoomsService

type RoomsService service

RoomsService is an interface for interfacing with the Rooms endpoints of the Cisco Spark API

func (*RoomsService) DeleteRoom

func (s *RoomsService) DeleteRoom(roomID string) (*Response, error)

DeleteRoom ....

func (*RoomsService) Get

func (s *RoomsService) Get(queryParams *RoomQueryParams) ([]*Room, *Response, error)

Get ....

func (*RoomsService) GetRoom

func (s *RoomsService) GetRoom(roomID string) (*Room, *Response, error)

GetRoom ....

func (*RoomsService) Post

func (s *RoomsService) Post(roomRequest *RoomRequest) (*Room, *Response, error)

Post ....

func (*RoomsService) UpdateRoom

func (s *RoomsService) UpdateRoom(roomID string, updateRoomRequest *UpdateRoomRequest) (*Room, *Response, error)

UpdateRoom ....

type Team

type Team struct {
	ID      string `json:"id,omitempty"`
	Name    string `json:"name,omitempty"`
	Created string `json:"created,omitempty"`
}

Team ...

func (Team) String

func (r Team) String() string

type TeamMembership

type TeamMembership struct {
	ID          string `json:"id,omitempty"`
	TeamID      string `json:"teamId,omitempty"`
	PersonID    string `json:"personId,omitempty"`
	PersonEmail string `json:"personEmail,omitempty"`
	IsModerator bool   `json:"isModerator,omitempty"`
	Created     string `json:"created,omitempty"`
}

TeamMembership ...

func (TeamMembership) String

func (r TeamMembership) String() string

type TeamMembershipQueryParams

type TeamMembershipQueryParams struct {
	Max    int    `url:"max,omitempty"`
	TeamID string `url:"teamId,omitempty"`
}

TeamMembershipQueryParams ...

type TeamMembershipRequest

type TeamMembershipRequest struct {
	TeamID      string `json:"teamId,omitempty"`
	PersonID    string `json:"personId,omitempty"`
	PersonEmail string `json:"personEmail,omitempty"`
	IsModerator bool   `json:"isModerator,omitempty"`
}

TeamMembershipRequest represents the Spark teamMemberships

func (TeamMembershipRequest) String

func (r TeamMembershipRequest) String() string

type TeamMembershipsService

type TeamMembershipsService service

TeamMembershipsService is an interface for interfacing with the TeamMemberships endpoints of the Cisco Spark API

func (*TeamMembershipsService) DeleteTeamMembership

func (s *TeamMembershipsService) DeleteTeamMembership(teamID string) (*Response, error)

DeleteTeamMembership ....

func (*TeamMembershipsService) Get

Get ....

func (*TeamMembershipsService) GetTeamMembership

func (s *TeamMembershipsService) GetTeamMembership(teamID string) (*TeamMembership, *Response, error)

GetTeamMembership ....

func (*TeamMembershipsService) Post

Post ....

func (*TeamMembershipsService) UpdateTeamMembership

func (s *TeamMembershipsService) UpdateTeamMembership(teamID string, updateTeamMembershipRequest *UpdateTeamMembershipRequest) (*TeamMembership, *Response, error)

UpdateTeamMembership ....

type TeamQueryParams

type TeamQueryParams struct {
	Max int `url:"max,omitempty"`
}

TeamQueryParams ...

type TeamRequest

type TeamRequest struct {
	Name string `json:"name,omitempty"`
}

TeamRequest represents the Spark teams

func (TeamRequest) String

func (r TeamRequest) String() string

type TeamsService

type TeamsService service

TeamsService is an interface for interfacing with the Teams endpoints of the Cisco Spark API

func (*TeamsService) DeleteTeam

func (s *TeamsService) DeleteTeam(teamID string) (*Response, error)

DeleteTeam ....

func (*TeamsService) Get

func (s *TeamsService) Get(queryParams *TeamQueryParams) ([]*Team, *Response, error)

Get ....

func (*TeamsService) GetTeam

func (s *TeamsService) GetTeam(teamID string) (*Team, *Response, error)

GetTeam ....

func (*TeamsService) Post

func (s *TeamsService) Post(teamRequest *TeamRequest) (*Team, *Response, error)

Post ....

func (*TeamsService) UpdateTeam

func (s *TeamsService) UpdateTeam(teamID string, updateTeamRequest *UpdateTeamRequest) (*Team, *Response, error)

UpdateTeam ....

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. All exported methods of time.Time can be called on Timestamp.

func (Timestamp) Equal

func (t Timestamp) Equal(u Timestamp) bool

Equal reports whether t and u are equal based on time.Equal

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.

type UpdateMembershipRequest

type UpdateMembershipRequest struct {
	IsModerator bool `json:"isModerator,omitempty"`
}

UpdateMembershipRequest represents the Spark memberships

type UpdateRoomRequest

type UpdateRoomRequest struct {
	Title string `json:"title,omitempty"`
}

UpdateRoomRequest represents the Spark rooms

type UpdateTeamMembershipRequest

type UpdateTeamMembershipRequest struct {
	IsModerator bool `json:"isModerator,omitempty"`
}

UpdateTeamMembershipRequest represents the Spark teamMemberships

type UpdateTeamRequest

type UpdateTeamRequest struct {
	Name string `json:"name,omitempty"`
}

UpdateTeamRequest represents the Spark teams

type UpdateWebhookRequest

type UpdateWebhookRequest struct {
	Name      string `json:"name,omitempty"`
	TargetURL string `json:"targetUrl,omitempty"`
}

UpdateWebhookRequest represents the Spark webhooks

type Webhook

type Webhook struct {
	ID        string `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	TargetURL string `json:"targetUrl,omitempty"`
	Resource  string `json:"resource,omitempty"`
	Event     string `json:"event,omitempty"`
	Filter    string `json:"filter,omitempty"`
	Created   string `json:"created,omitempty"`
}

Webhook ...

func (Webhook) String

func (r Webhook) String() string

type WebhookQueryParams

type WebhookQueryParams struct {
	Max int `url:"max,omitempty"`
}

WebhookQueryParams ...

type WebhookRequest

type WebhookRequest struct {
	Name      string `json:"name,omitempty"`
	TargetURL string `json:"targetUrl,omitempty"`
	Resource  string `json:"resource,omitempty"`
	Event     string `json:"event,omitempty"`
	Filter    string `json:"filter,omitempty"`
}

WebhookRequest represents the Spark webhooks

func (WebhookRequest) String

func (r WebhookRequest) String() string

type WebhooksService

type WebhooksService service

WebhooksService is an interface for interfacing with the Webhooks endpoints of the Cisco Spark API

func (*WebhooksService) DeleteWebhook

func (s *WebhooksService) DeleteWebhook(webhookID string) (*Response, error)

DeleteWebhook ....

func (*WebhooksService) Get

func (s *WebhooksService) Get(queryParams *WebhookQueryParams) ([]*Webhook, *Response, error)

Get ....

func (*WebhooksService) GetWebhook

func (s *WebhooksService) GetWebhook(webhookID string) (*Webhook, *Response, error)

GetWebhook ....

func (*WebhooksService) Post

func (s *WebhooksService) Post(webhookRequest *WebhookRequest) (*Webhook, *Response, error)

Post ....

func (*WebhooksService) UpdateWebhook

func (s *WebhooksService) UpdateWebhook(webhookID string, updateWebhookRequest *UpdateWebhookRequest) (*Webhook, *Response, error)

UpdateWebhook ....

Jump to

Keyboard shortcuts

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