Example #1
0
File: rpc.go Project: ycycwx/acgsh
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
}
Example #2
0
File: rpc.go Project: ycycwx/acgsh
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
}
Example #3
0
File: rpc.go Project: ycycwx/acgsh
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
}
Example #4
0
File: rpc.go Project: ycycwx/acgsh
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
}
Example #5
0
File: rpc.go Project: ycycwx/acgsh
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
}