#!/usr/bin/env python # # Autogenerated by Thrift Compiler (0.14.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py # import sys import pprint if sys.version_info[0] > 2: from urllib.parse import urlparse else: from urlparse import urlparse from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient from thrift.protocol.TBinaryProtocol import TBinaryProtocol from line import BuddyManagementService from line.ttypes import * if len(sys.argv) <= 1 or sys.argv[1] == '--help': print('') print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]') print('') print('Functions:') print(' void addBuddyMember(string requestId, string userMid)') print(' void addBuddyMembers(string requestId, userMids)') print(' void blockBuddyMember(string requestId, string mid)') print(' commitSendMessagesToAll( requestIdList)') print(' commitSendMessagesToMids( requestIdList, mids)') print(' bool containsBuddyMember(string requestId, string userMid)') print(' string downloadMessageContent(string requestId, string messageId)') print(' string downloadMessageContentPreview(string requestId, string messageId)') print(' string downloadProfileImage(string requestId)') print(' string downloadProfileImagePreview(string requestId)') print(' i64 getActiveMemberCountByBuddyMid(string buddyMid)') print(' getActiveMemberMidsByBuddyMid(string buddyMid)') print(' getAllBuddyMembers()') print(' getBlockedBuddyMembers()') print(' i64 getBlockerCountByBuddyMid(string buddyMid)') print(' BuddyDetail getBuddyDetailByMid(string buddyMid)') print(' BuddyProfile getBuddyProfile()') print(' Ticket getContactTicket()') print(' i64 getMemberCountByBuddyMid(string buddyMid)') print(' SendBuddyMessageResult getSendBuddyMessageResult(string sendBuddyMessageRequestId)') print(' SetBuddyOnAirResult getSetBuddyOnAirResult(string setBuddyOnAirRequestId)') print(' UpdateBuddyProfileResult getUpdateBuddyProfileResult(string updateBuddyProfileRequestId)') print(' bool isBuddyOnAirByMid(string buddyMid)') print(' string linkAndSendBuddyContentMessageToAllAsync(string requestId, Message msg, string sourceContentId)') print(' SendBuddyMessageResult linkAndSendBuddyContentMessageToMids(string requestId, Message msg, string sourceContentId, mids)') print(' void notifyBuddyBlocked(string buddyMid, string blockerMid)') print(' void notifyBuddyUnblocked(string buddyMid, string blockerMid)') print(' string registerBuddy(string buddyId, string searchId, string displayName, string statusMeessage, string picture, settings)') print(' string registerBuddyAdmin(string buddyId, string searchId, string displayName, string statusMessage, string picture)') print(' string reissueContactTicket(i64 expirationTime, i32 maxUseCount)') print(' void removeBuddyMember(string requestId, string userMid)') print(' void removeBuddyMembers(string requestId, userMids)') print(' SendBuddyMessageResult sendBuddyContentMessageToAll(string requestId, Message msg, string content)') print(' string sendBuddyContentMessageToAllAsync(string requestId, Message msg, string content)') print(' SendBuddyMessageResult sendBuddyContentMessageToMids(string requestId, Message msg, string content, mids)') print(' string sendBuddyContentMessageToMidsAsync(string requestId, Message msg, string content, mids)') print(' SendBuddyMessageResult sendBuddyMessageToAll(string requestId, Message msg)') print(' string sendBuddyMessageToAllAsync(string requestId, Message msg)') print(' SendBuddyMessageResult sendBuddyMessageToMids(string requestId, Message msg, mids)') print(' string sendBuddyMessageToMidsAsync(string requestId, Message msg, mids)') print(' void sendIndividualEventToAllAsync(string requestId, string buddyMid, NotificationStatus notificationStatus)') print(' SetBuddyOnAirResult setBuddyOnAir(string requestId, bool onAir)') print(' string setBuddyOnAirAsync(string requestId, bool onAir)') print(' SendBuddyMessageResult storeMessage(string requestId, BuddyMessageRequest messageRequest)') print(' void unblockBuddyMember(string requestId, string mid)') print(' void unregisterBuddy(string requestId)') print(' void unregisterBuddyAdmin(string requestId)') print(' void updateBuddyAdminProfileAttribute(string requestId, attributes)') print(' void updateBuddyAdminProfileImage(string requestId, string picture)') print(' UpdateBuddyProfileResult updateBuddyProfileAttributes(string requestId, attributes)') print(' string updateBuddyProfileAttributesAsync(string requestId, attributes)') print(' UpdateBuddyProfileResult updateBuddyProfileImage(string requestId, string image)') print(' string updateBuddyProfileImageAsync(string requestId, string image)') print(' void updateBuddySearchId(string requestId, string searchId)') print(' void updateBuddySettings( settings)') print(' string uploadBuddyContent(ContentType contentType, string content)') print('') sys.exit(0) pp = pprint.PrettyPrinter(indent=2) host = 'localhost' port = 9090 uri = '' framed = False ssl = False validate = True ca_certs = None keyfile = None certfile = None http = False argi = 1 if sys.argv[argi] == '-h': parts = sys.argv[argi + 1].split(':') host = parts[0] if len(parts) > 1: port = int(parts[1]) argi += 2 if sys.argv[argi] == '-u': url = urlparse(sys.argv[argi + 1]) parts = url[1].split(':') host = parts[0] if len(parts) > 1: port = int(parts[1]) else: port = 80 uri = url[2] if url[4]: uri += '?%s' % url[4] http = True argi += 2 if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': framed = True argi += 1 if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl': ssl = True argi += 1 if sys.argv[argi] == '-novalidate': validate = False argi += 1 if sys.argv[argi] == '-ca_certs': ca_certs = sys.argv[argi+1] argi += 2 if sys.argv[argi] == '-keyfile': keyfile = sys.argv[argi+1] argi += 2 if sys.argv[argi] == '-certfile': certfile = sys.argv[argi+1] argi += 2 cmd = sys.argv[argi] args = sys.argv[argi + 1:] if http: transport = THttpClient.THttpClient(host, port, uri) else: if ssl: socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile) else: socket = TSocket.TSocket(host, port) if framed: transport = TTransport.TFramedTransport(socket) else: transport = TTransport.TBufferedTransport(socket) protocol = TBinaryProtocol(transport) client = BuddyManagementService.Client(protocol) transport.open() if cmd == 'addBuddyMember': if len(args) != 2: print('addBuddyMember requires 2 args') sys.exit(1) pp.pprint(client.addBuddyMember(args[0], args[1],)) elif cmd == 'addBuddyMembers': if len(args) != 2: print('addBuddyMembers requires 2 args') sys.exit(1) pp.pprint(client.addBuddyMembers(args[0], eval(args[1]),)) elif cmd == 'blockBuddyMember': if len(args) != 2: print('blockBuddyMember requires 2 args') sys.exit(1) pp.pprint(client.blockBuddyMember(args[0], args[1],)) elif cmd == 'commitSendMessagesToAll': if len(args) != 1: print('commitSendMessagesToAll requires 1 args') sys.exit(1) pp.pprint(client.commitSendMessagesToAll(eval(args[0]),)) elif cmd == 'commitSendMessagesToMids': if len(args) != 2: print('commitSendMessagesToMids requires 2 args') sys.exit(1) pp.pprint(client.commitSendMessagesToMids(eval(args[0]), eval(args[1]),)) elif cmd == 'containsBuddyMember': if len(args) != 2: print('containsBuddyMember requires 2 args') sys.exit(1) pp.pprint(client.containsBuddyMember(args[0], args[1],)) elif cmd == 'downloadMessageContent': if len(args) != 2: print('downloadMessageContent requires 2 args') sys.exit(1) pp.pprint(client.downloadMessageContent(args[0], args[1],)) elif cmd == 'downloadMessageContentPreview': if len(args) != 2: print('downloadMessageContentPreview requires 2 args') sys.exit(1) pp.pprint(client.downloadMessageContentPreview(args[0], args[1],)) elif cmd == 'downloadProfileImage': if len(args) != 1: print('downloadProfileImage requires 1 args') sys.exit(1) pp.pprint(client.downloadProfileImage(args[0],)) elif cmd == 'downloadProfileImagePreview': if len(args) != 1: print('downloadProfileImagePreview requires 1 args') sys.exit(1) pp.pprint(client.downloadProfileImagePreview(args[0],)) elif cmd == 'getActiveMemberCountByBuddyMid': if len(args) != 1: print('getActiveMemberCountByBuddyMid requires 1 args') sys.exit(1) pp.pprint(client.getActiveMemberCountByBuddyMid(args[0],)) elif cmd == 'getActiveMemberMidsByBuddyMid': if len(args) != 1: print('getActiveMemberMidsByBuddyMid requires 1 args') sys.exit(1) pp.pprint(client.getActiveMemberMidsByBuddyMid(args[0],)) elif cmd == 'getAllBuddyMembers': if len(args) != 0: print('getAllBuddyMembers requires 0 args') sys.exit(1) pp.pprint(client.getAllBuddyMembers()) elif cmd == 'getBlockedBuddyMembers': if len(args) != 0: print('getBlockedBuddyMembers requires 0 args') sys.exit(1) pp.pprint(client.getBlockedBuddyMembers()) elif cmd == 'getBlockerCountByBuddyMid': if len(args) != 1: print('getBlockerCountByBuddyMid requires 1 args') sys.exit(1) pp.pprint(client.getBlockerCountByBuddyMid(args[0],)) elif cmd == 'getBuddyDetailByMid': if len(args) != 1: print('getBuddyDetailByMid requires 1 args') sys.exit(1) pp.pprint(client.getBuddyDetailByMid(args[0],)) elif cmd == 'getBuddyProfile': if len(args) != 0: print('getBuddyProfile requires 0 args') sys.exit(1) pp.pprint(client.getBuddyProfile()) elif cmd == 'getContactTicket': if len(args) != 0: print('getContactTicket requires 0 args') sys.exit(1) pp.pprint(client.getContactTicket()) elif cmd == 'getMemberCountByBuddyMid': if len(args) != 1: print('getMemberCountByBuddyMid requires 1 args') sys.exit(1) pp.pprint(client.getMemberCountByBuddyMid(args[0],)) elif cmd == 'getSendBuddyMessageResult': if len(args) != 1: print('getSendBuddyMessageResult requires 1 args') sys.exit(1) pp.pprint(client.getSendBuddyMessageResult(args[0],)) elif cmd == 'getSetBuddyOnAirResult': if len(args) != 1: print('getSetBuddyOnAirResult requires 1 args') sys.exit(1) pp.pprint(client.getSetBuddyOnAirResult(args[0],)) elif cmd == 'getUpdateBuddyProfileResult': if len(args) != 1: print('getUpdateBuddyProfileResult requires 1 args') sys.exit(1) pp.pprint(client.getUpdateBuddyProfileResult(args[0],)) elif cmd == 'isBuddyOnAirByMid': if len(args) != 1: print('isBuddyOnAirByMid requires 1 args') sys.exit(1) pp.pprint(client.isBuddyOnAirByMid(args[0],)) elif cmd == 'linkAndSendBuddyContentMessageToAllAsync': if len(args) != 3: print('linkAndSendBuddyContentMessageToAllAsync requires 3 args') sys.exit(1) pp.pprint(client.linkAndSendBuddyContentMessageToAllAsync(args[0], eval(args[1]), args[2],)) elif cmd == 'linkAndSendBuddyContentMessageToMids': if len(args) != 4: print('linkAndSendBuddyContentMessageToMids requires 4 args') sys.exit(1) pp.pprint(client.linkAndSendBuddyContentMessageToMids(args[0], eval(args[1]), args[2], eval(args[3]),)) elif cmd == 'notifyBuddyBlocked': if len(args) != 2: print('notifyBuddyBlocked requires 2 args') sys.exit(1) pp.pprint(client.notifyBuddyBlocked(args[0], args[1],)) elif cmd == 'notifyBuddyUnblocked': if len(args) != 2: print('notifyBuddyUnblocked requires 2 args') sys.exit(1) pp.pprint(client.notifyBuddyUnblocked(args[0], args[1],)) elif cmd == 'registerBuddy': if len(args) != 6: print('registerBuddy requires 6 args') sys.exit(1) pp.pprint(client.registerBuddy(args[0], args[1], args[2], args[3], args[4], eval(args[5]),)) elif cmd == 'registerBuddyAdmin': if len(args) != 5: print('registerBuddyAdmin requires 5 args') sys.exit(1) pp.pprint(client.registerBuddyAdmin(args[0], args[1], args[2], args[3], args[4],)) elif cmd == 'reissueContactTicket': if len(args) != 2: print('reissueContactTicket requires 2 args') sys.exit(1) pp.pprint(client.reissueContactTicket(eval(args[0]), eval(args[1]),)) elif cmd == 'removeBuddyMember': if len(args) != 2: print('removeBuddyMember requires 2 args') sys.exit(1) pp.pprint(client.removeBuddyMember(args[0], args[1],)) elif cmd == 'removeBuddyMembers': if len(args) != 2: print('removeBuddyMembers requires 2 args') sys.exit(1) pp.pprint(client.removeBuddyMembers(args[0], eval(args[1]),)) elif cmd == 'sendBuddyContentMessageToAll': if len(args) != 3: print('sendBuddyContentMessageToAll requires 3 args') sys.exit(1) pp.pprint(client.sendBuddyContentMessageToAll(args[0], eval(args[1]), args[2],)) elif cmd == 'sendBuddyContentMessageToAllAsync': if len(args) != 3: print('sendBuddyContentMessageToAllAsync requires 3 args') sys.exit(1) pp.pprint(client.sendBuddyContentMessageToAllAsync(args[0], eval(args[1]), args[2],)) elif cmd == 'sendBuddyContentMessageToMids': if len(args) != 4: print('sendBuddyContentMessageToMids requires 4 args') sys.exit(1) pp.pprint(client.sendBuddyContentMessageToMids(args[0], eval(args[1]), args[2], eval(args[3]),)) elif cmd == 'sendBuddyContentMessageToMidsAsync': if len(args) != 4: print('sendBuddyContentMessageToMidsAsync requires 4 args') sys.exit(1) pp.pprint(client.sendBuddyContentMessageToMidsAsync(args[0], eval(args[1]), args[2], eval(args[3]),)) elif cmd == 'sendBuddyMessageToAll': if len(args) != 2: print('sendBuddyMessageToAll requires 2 args') sys.exit(1) pp.pprint(client.sendBuddyMessageToAll(args[0], eval(args[1]),)) elif cmd == 'sendBuddyMessageToAllAsync': if len(args) != 2: print('sendBuddyMessageToAllAsync requires 2 args') sys.exit(1) pp.pprint(client.sendBuddyMessageToAllAsync(args[0], eval(args[1]),)) elif cmd == 'sendBuddyMessageToMids': if len(args) != 3: print('sendBuddyMessageToMids requires 3 args') sys.exit(1) pp.pprint(client.sendBuddyMessageToMids(args[0], eval(args[1]), eval(args[2]),)) elif cmd == 'sendBuddyMessageToMidsAsync': if len(args) != 3: print('sendBuddyMessageToMidsAsync requires 3 args') sys.exit(1) pp.pprint(client.sendBuddyMessageToMidsAsync(args[0], eval(args[1]), eval(args[2]),)) elif cmd == 'sendIndividualEventToAllAsync': if len(args) != 3: print('sendIndividualEventToAllAsync requires 3 args') sys.exit(1) pp.pprint(client.sendIndividualEventToAllAsync(args[0], args[1], eval(args[2]),)) elif cmd == 'setBuddyOnAir': if len(args) != 2: print('setBuddyOnAir requires 2 args') sys.exit(1) pp.pprint(client.setBuddyOnAir(args[0], eval(args[1]),)) elif cmd == 'setBuddyOnAirAsync': if len(args) != 2: print('setBuddyOnAirAsync requires 2 args') sys.exit(1) pp.pprint(client.setBuddyOnAirAsync(args[0], eval(args[1]),)) elif cmd == 'storeMessage': if len(args) != 2: print('storeMessage requires 2 args') sys.exit(1) pp.pprint(client.storeMessage(args[0], eval(args[1]),)) elif cmd == 'unblockBuddyMember': if len(args) != 2: print('unblockBuddyMember requires 2 args') sys.exit(1) pp.pprint(client.unblockBuddyMember(args[0], args[1],)) elif cmd == 'unregisterBuddy': if len(args) != 1: print('unregisterBuddy requires 1 args') sys.exit(1) pp.pprint(client.unregisterBuddy(args[0],)) elif cmd == 'unregisterBuddyAdmin': if len(args) != 1: print('unregisterBuddyAdmin requires 1 args') sys.exit(1) pp.pprint(client.unregisterBuddyAdmin(args[0],)) elif cmd == 'updateBuddyAdminProfileAttribute': if len(args) != 2: print('updateBuddyAdminProfileAttribute requires 2 args') sys.exit(1) pp.pprint(client.updateBuddyAdminProfileAttribute(args[0], eval(args[1]),)) elif cmd == 'updateBuddyAdminProfileImage': if len(args) != 2: print('updateBuddyAdminProfileImage requires 2 args') sys.exit(1) pp.pprint(client.updateBuddyAdminProfileImage(args[0], args[1],)) elif cmd == 'updateBuddyProfileAttributes': if len(args) != 2: print('updateBuddyProfileAttributes requires 2 args') sys.exit(1) pp.pprint(client.updateBuddyProfileAttributes(args[0], eval(args[1]),)) elif cmd == 'updateBuddyProfileAttributesAsync': if len(args) != 2: print('updateBuddyProfileAttributesAsync requires 2 args') sys.exit(1) pp.pprint(client.updateBuddyProfileAttributesAsync(args[0], eval(args[1]),)) elif cmd == 'updateBuddyProfileImage': if len(args) != 2: print('updateBuddyProfileImage requires 2 args') sys.exit(1) pp.pprint(client.updateBuddyProfileImage(args[0], args[1],)) elif cmd == 'updateBuddyProfileImageAsync': if len(args) != 2: print('updateBuddyProfileImageAsync requires 2 args') sys.exit(1) pp.pprint(client.updateBuddyProfileImageAsync(args[0], args[1],)) elif cmd == 'updateBuddySearchId': if len(args) != 2: print('updateBuddySearchId requires 2 args') sys.exit(1) pp.pprint(client.updateBuddySearchId(args[0], args[1],)) elif cmd == 'updateBuddySettings': if len(args) != 1: print('updateBuddySettings requires 1 args') sys.exit(1) pp.pprint(client.updateBuddySettings(eval(args[0]),)) elif cmd == 'uploadBuddyContent': if len(args) != 2: print('uploadBuddyContent requires 2 args') sys.exit(1) pp.pprint(client.uploadBuddyContent(eval(args[0]), args[1],)) else: print('Unrecognized method %s' % cmd) sys.exit(1) transport.close()