Exemple #1
0
func GetFollowing(name string) (*[]string, error) {
	//
	id++
	resp, err := httpjsonrpc.Call(Address, "getfollowing", id, []interface{}{name})
	if err != nil {
		log.Println(err)
		log.Printf("Error: RPC GetFollowing: %+v", resp)
		return nil, err
	}
	result := resp.Result
	if resp.Error != nil {
		log.Printf("Error: RPC GetFollowing: %+v", resp)
		return nil, fmt.Errorf("RPC error")
	}

	var following []string
	err = json.Unmarshal(result, &following)
	if err != nil {
		log.Println(err)
		log.Printf("Error: RPC GetFollowing Unmarshal: %+v", result)
		return nil, err
	}

	return &following, nil
}
Exemple #2
0
func ListWalletUsers() (interface{}, error) {
	//
	id++
	resp, err := httpjsonrpc.Call(Address, "listwalletusers", id, nil)
	if err != nil {
		log.Println(err)
		return resp, err
	}
	result := resp.Result
	//log.Println(resp)

	return result, err
}
Exemple #3
0
func UnFollow(name string, followUserNames []string) (interface{}, error) {
	//
	id++
	resp, err := httpjsonrpc.Call(Address, "unfollow", id, []interface{}{name, followUserNames})
	if err != nil {
		log.Println(err)
		return resp, err
	}
	result := resp.Result
	//log.Println(resp)

	return result, err
}
Exemple #4
0
func Follow(name string, followUserNames []string) (interface{}, error) {
	//
	id++
	resp, err := httpjsonrpc.Call(Address, "follow", id, []interface{}{name, followUserNames})
	if err != nil {
		log.Println(err)
		log.Printf("Error: RPC Follow: %+v", resp)
		return nil, err
	}

	_ = resp.Result
	if resp.Error != nil {
		log.Printf("Error: RPC Follow: %+v", resp)
		return nil, fmt.Errorf("RPC error")
	}

	return resp, err
}
Exemple #5
0
func GetPosts(count int64, params []interface{}) (*TwisterPosts, error) {
	//
	id++
	resp, err := httpjsonrpc.Call(Address, "getposts", id, []interface{}{count, params})
	if err != nil {
		log.Println(err)
		return nil, err
	}
	result := resp.Result
	if resp.Error != nil {
		log.Printf("Error: RPC GetPosts: %+v", resp)
		return nil, fmt.Errorf("RPC error")
	}
	//fmt.Println(string(result))
	var tp TwisterPosts
	err = json.Unmarshal(result, &tp)
	if err != nil {
		log.Println(err)
		log.Printf("Error: RPC GetPosts Unmarshal: %+v", result)
		return nil, err
	}

	return &tp, nil
}