yuuki/libs/core/ShopService-remote

286 lines
10 KiB
Text
Raw Normal View History

2019-12-25 21:42:39 +08:00
#!/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 ShopService
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 buyCoinProduct(PaymentReservation paymentReservation)')
print(' void buyFreeProduct(string receiverMid, string productId, i32 messageTemplate, string language, string country, i64 packageId)')
print(' void buyMustbuyProduct(string receiverMid, string productId, i32 messageTemplate, string language, string country, i64 packageId, string serialNumber)')
print(' void checkCanReceivePresent(string recipientMid, i64 packageId, string language, string country)')
print(' ProductList getActivePurchases(i64 start, i32 size, string language, string country)')
print(' ProductSimpleList getActivePurchaseVersions(i64 start, i32 size, string language, string country)')
print(' getCoinProducts(PaymentType appStoreCode, string country, string language)')
print(' getCoinProductsByPgCode(PaymentType appStoreCode, PaymentPgType pgCode, string country, string language)')
print(' CoinHistoryResult getCoinPurchaseHistory(CoinHistoryCondition request)')
print(' CoinHistoryResult getCoinUseAndRefundHistory(CoinHistoryCondition request)')
print(' ProductList getDownloads(i64 start, i32 size, string language, string country)')
print(' ProductList getEventPackages(i64 start, i32 size, string language, string country)')
print(' ProductList getNewlyReleasedPackages(i64 start, i32 size, string language, string country)')
print(' ProductList getPopularPackages(i64 start, i32 size, string language, string country)')
print(' ProductList getPresentsReceived(i64 start, i32 size, string language, string country)')
print(' ProductList getPresentsSent(i64 start, i32 size, string language, string country)')
print(' Product getProduct(i64 packageID, string language, string country)')
print(' ProductList getProductList( productIdList, string language, string country)')
print(' ProductList getProductListWithCarrier( productIdList, string language, string country, string carrierCode)')
print(' Product getProductWithCarrier(i64 packageID, string language, string country, string carrierCode)')
print(' ProductList getPurchaseHistory(i64 start, i32 size, string language, string country)')
print(' Coin getTotalBalance(PaymentType appStoreCode)')
print(' i64 notifyDownloaded(i64 packageId, string language)')
print(' PaymentReservationResult reserveCoinPurchase(CoinPurchaseReservation request)')
print(' PaymentReservationResult reservePayment(PaymentReservation paymentReservation)')
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 = ShopService.Client(protocol)
transport.open()
if cmd == 'buyCoinProduct':
if len(args) != 1:
print('buyCoinProduct requires 1 args')
sys.exit(1)
pp.pprint(client.buyCoinProduct(eval(args[0]),))
elif cmd == 'buyFreeProduct':
if len(args) != 6:
print('buyFreeProduct requires 6 args')
sys.exit(1)
pp.pprint(client.buyFreeProduct(args[0], args[1], eval(args[2]), args[3], args[4], eval(args[5]),))
elif cmd == 'buyMustbuyProduct':
if len(args) != 7:
print('buyMustbuyProduct requires 7 args')
sys.exit(1)
pp.pprint(client.buyMustbuyProduct(args[0], args[1], eval(args[2]), args[3], args[4], eval(args[5]), args[6],))
elif cmd == 'checkCanReceivePresent':
if len(args) != 4:
print('checkCanReceivePresent requires 4 args')
sys.exit(1)
pp.pprint(client.checkCanReceivePresent(args[0], eval(args[1]), args[2], args[3],))
elif cmd == 'getActivePurchases':
if len(args) != 4:
print('getActivePurchases requires 4 args')
sys.exit(1)
pp.pprint(client.getActivePurchases(eval(args[0]), eval(args[1]), args[2], args[3],))
elif cmd == 'getActivePurchaseVersions':
if len(args) != 4:
print('getActivePurchaseVersions requires 4 args')
sys.exit(1)
pp.pprint(client.getActivePurchaseVersions(eval(args[0]), eval(args[1]), args[2], args[3],))
elif cmd == 'getCoinProducts':
if len(args) != 3:
print('getCoinProducts requires 3 args')
sys.exit(1)
pp.pprint(client.getCoinProducts(eval(args[0]), args[1], args[2],))
elif cmd == 'getCoinProductsByPgCode':
if len(args) != 4:
print('getCoinProductsByPgCode requires 4 args')
sys.exit(1)
pp.pprint(client.getCoinProductsByPgCode(eval(args[0]), eval(args[1]), args[2], args[3],))
elif cmd == 'getCoinPurchaseHistory':
if len(args) != 1:
print('getCoinPurchaseHistory requires 1 args')
sys.exit(1)
pp.pprint(client.getCoinPurchaseHistory(eval(args[0]),))
elif cmd == 'getCoinUseAndRefundHistory':
if len(args) != 1:
print('getCoinUseAndRefundHistory requires 1 args')
sys.exit(1)
pp.pprint(client.getCoinUseAndRefundHistory(eval(args[0]),))
elif cmd == 'getDownloads':
if len(args) != 4:
print('getDownloads requires 4 args')
sys.exit(1)
pp.pprint(client.getDownloads(eval(args[0]), eval(args[1]), args[2], args[3],))
elif cmd == 'getEventPackages':
if len(args) != 4:
print('getEventPackages requires 4 args')
sys.exit(1)
pp.pprint(client.getEventPackages(eval(args[0]), eval(args[1]), args[2], args[3],))
elif cmd == 'getNewlyReleasedPackages':
if len(args) != 4:
print('getNewlyReleasedPackages requires 4 args')
sys.exit(1)
pp.pprint(client.getNewlyReleasedPackages(eval(args[0]), eval(args[1]), args[2], args[3],))
elif cmd == 'getPopularPackages':
if len(args) != 4:
print('getPopularPackages requires 4 args')
sys.exit(1)
pp.pprint(client.getPopularPackages(eval(args[0]), eval(args[1]), args[2], args[3],))
elif cmd == 'getPresentsReceived':
if len(args) != 4:
print('getPresentsReceived requires 4 args')
sys.exit(1)
pp.pprint(client.getPresentsReceived(eval(args[0]), eval(args[1]), args[2], args[3],))
elif cmd == 'getPresentsSent':
if len(args) != 4:
print('getPresentsSent requires 4 args')
sys.exit(1)
pp.pprint(client.getPresentsSent(eval(args[0]), eval(args[1]), args[2], args[3],))
elif cmd == 'getProduct':
if len(args) != 3:
print('getProduct requires 3 args')
sys.exit(1)
pp.pprint(client.getProduct(eval(args[0]), args[1], args[2],))
elif cmd == 'getProductList':
if len(args) != 3:
print('getProductList requires 3 args')
sys.exit(1)
pp.pprint(client.getProductList(eval(args[0]), args[1], args[2],))
elif cmd == 'getProductListWithCarrier':
if len(args) != 4:
print('getProductListWithCarrier requires 4 args')
sys.exit(1)
pp.pprint(client.getProductListWithCarrier(eval(args[0]), args[1], args[2], args[3],))
elif cmd == 'getProductWithCarrier':
if len(args) != 4:
print('getProductWithCarrier requires 4 args')
sys.exit(1)
pp.pprint(client.getProductWithCarrier(eval(args[0]), args[1], args[2], args[3],))
elif cmd == 'getPurchaseHistory':
if len(args) != 4:
print('getPurchaseHistory requires 4 args')
sys.exit(1)
pp.pprint(client.getPurchaseHistory(eval(args[0]), eval(args[1]), args[2], args[3],))
elif cmd == 'getTotalBalance':
if len(args) != 1:
print('getTotalBalance requires 1 args')
sys.exit(1)
pp.pprint(client.getTotalBalance(eval(args[0]),))
elif cmd == 'notifyDownloaded':
if len(args) != 2:
print('notifyDownloaded requires 2 args')
sys.exit(1)
pp.pprint(client.notifyDownloaded(eval(args[0]), args[1],))
elif cmd == 'reserveCoinPurchase':
if len(args) != 1:
print('reserveCoinPurchase requires 1 args')
sys.exit(1)
pp.pprint(client.reserveCoinPurchase(eval(args[0]),))
elif cmd == 'reservePayment':
if len(args) != 1:
print('reservePayment requires 1 args')
sys.exit(1)
pp.pprint(client.reservePayment(eval(args[0]),))
else:
print('Unrecognized method %s' % cmd)
sys.exit(1)
transport.close()