package goctk import ( "encoding/json" ) // Start Contact by SSO query, returns a list of attributes associated with the contact type ( ContactsBySso struct { Count int `json:"count"` Class string `json:"class"` Limit int `json:"limit"` Result []ContactBySso `json:"result"` Offset int `json:"offset"` } ContactBySso struct { ID int `json:"id"` Name string `json:"name"` Title string `json:"title"` } Contact struct { CoreClass } ) func (c *Client) ContactBySso(sso string) (*ContactBySso, error) { type ctk struct { Class string `json:"class"` LoadArg LoadArg `json:"load_arg"` Attributes []interface{} `json:"attributes"` } t := ctk{ Class: "Contact.Contact", LoadArg: LoadArg{ Values: []interface{}{"employee_userid", "=", sso}, Class: "Contact.ContactWhere", }, Attributes: []interface{}{"name", "id", "title"}, } js, err := json.Marshal(t) if err != nil { return nil, err } res, err := c.Query(js) if err != nil { return nil, err } var ur ContactsBySso if err := json.Unmarshal(res, &[]interface{}{&ur}); err != nil { return nil, err } return &ur.Result[0], nil } // End Comptuer by sku query