def invitation_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = invitation_mobile_pb2_grpc.MobileStub(intercept_channel) response = stub.SubmitInvitationCode( invitation_mobile_pb2.SubmitInvitationCodeRequest( jwt_token=account_mobile_run.test_run(), invitation_code='2PU3W7')) print(response.error) response2 = stub.QueryInviteeBonus( invitation_mobile_pb2.QueryInviteeBonusRequest( invitee_username='******')) print(response2.bonus_amount, response2.currency, response2.invitee_username, response2.status, response2.error, response2.inviter_snip) response3 = stub.GetInvitationCode( invitation_mobile_pb2.InvitationCodeRequest( jwt_token=account_mobile_run.test_run())) print(response3.invitation_code, response3.error) response4 = stub.QueryInviterBonus( invitation_mobile_pb2.QueryInviterBonusRequest( inviter_username='******')) print(response4.reward_cash_per_first_deposit, response4.currency, response4.error)
def bank_API(): with open('server.crt', 'rb') as f: creds = grpc.ssl_channel_credentials(f.read()) token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', creds) intercept_channel = grpc.intercept_channel(channel, name) stub = bank_mobile_pb2_grpc.MobileStub(intercept_channel) response = stub.GetBalances( bank_mobile_pb2.GetBalancesRequest( jwt_token=account_mobile_run.test_run())) print(response.error)
def tournament_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = tournament_mobile_pb2_grpc.MobileStub(intercept_channel) # response = stub.GetMyTournamentTickets(tournament_mobile_pb2.TournamentPaginationRequest( # tournament_id='600', # limit=1, # next_page_token='' # )) # print(response.error, response.ticket, response.next_page_token) # # response2 = stub.GetTournamentRankings(tournament_mobile_pb2.TournamentPaginationRequest( # tournament_id='600', # limit=1, # next_page_token='' # )) # print(response2.error, response2.tournament_bucket, response2.current_player_ranking, # response2.rankings, response2.next_page_token) response3 = stub.GetTournamentDetail(tournament_mobile_pb2.TournamentIdRequest( tournament_id='600', )) print(response3.error, response3.bucket, response3.ranking, response3.should_notify, response3.exists_prize_to_claim, response3.gem_reward_note, response3.league_star_reward_note)
def notification_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = notification_mobile_pb2_grpc.MobileStub(intercept_channel) response = stub.RegisterEndpoint( notification_mobile_pb2.RegisterEndpointRequest( device_id='', app_id='', firebase_push_notification_token='', app_version='', device_type='', push_permission_granted='')) print(response.error) response1 = stub.GetPopupInAppMessages( notification_mobile_pb2.GetPopupInAppMessagesRequest(game_id=1, app_id=2, app_version='', device_type='')) print(response1.error, response1.popup_in_app_messages) response2 = stub.GetBannerInAppMessages( notification_mobile_pb2.GetBannerInAppMessagesRequest(app_id='', app_version='', device_type='')) print(response2.error, response2.banner_in_app_messages)
def social_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = social_mobile_pb2_grpc.MobileStub(intercept_channel) serverStub = social_mobile_pb2_grpc.SocialChallengeAPIsStub( intercept_channel) response = stub.GetUserFullProfile( social_mobile_pb2.GetUserFullProfileRequest(username='******', primary_account_type='', app_id='', device_type='')) print(response.error, response.user_social_profile, response.league_preview, response.game_records, response.match_flow_items) response1 = stub.GetUserSocialProfile( social_mobile_pb2.GetUserSocialProfileRequest(username='', primary_account_type='')) print(response1.error, response1.user_social_profile) response2 = serverStub.CreateSocialChallengeRelation( social_mobile_pb2.CreateChallengeRelationRequest( opponent_username='', app_id='', match_bucket_id='', challenge_message='', challenge_message_id='')) print(response2.error, response2.room_id) response2 = serverStub.GetSocialChallengeNotification( social_mobile_pb2.GetSocialChallengeNotificationRequest(app_id=None)) print(response2.error, response2.should_notify_social_challenge) response3 = stub.GetLiveFeedByAppId( social_mobile_pb2.GetLiveFeedByAppIdRequest(max_count=1, app_id='', device_type='', game_id='')) print(response3.error, response3.live_feeds) response4 = stub.GetMegaWinsFeedItems( social_mobile_pb2.GetMegaWinsFeedItemsRequest(max_count=1, app_id='', device_type='', game_id='')) print(response4.error, response4.feed)
def storage_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = storage_mobile_pb2_grpc.MobileStub(intercept_channel) response = stub.RecordInviterInfo( storage_mobile_pb2.RecordInviterInfoRequest( inviter_username='******', invitation_code='2PU3W7', inviter_avatar_url= 'https://celerx.app/invitation/?device=ios&app=network.celer.celerx&inviter=proud.asdic&code=2PU3W7', inviter_visible_username='******')) print(response.error)
def match_ticket_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = match_ticket_mobile_pb2_grpc.MobileStub(intercept_channel) response = stub.GetMatchDetailByTicketId( match_ticket_mobile_pb2.GetMatchDetailByTicketIdRequest( ticket_id='', app_version='', device_type='')) print(response.error, response.match_detail_info) response1 = stub.RefundWhenGameCrashed( match_ticket_mobile_pb2.RefundWhenGameCrashedRequest(ticket_id='', token='', submit_time='')) print(response1.error, response1.refund_result)
def history_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = history_mobile_pb2_grpc.MobileStub(intercept_channel) response = stub.c( history_mobile_pb2.GetGameHistoryRequest( page_request_list=mini, primary_account_type=2, needs_all_prize_claims=None, needs_top_acceptable_challenges=None, game_id='000403')) print(response.error, response.page_list, response.total_claim_prize, response.top_acceptable_challenges)
def league_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = league_mobile_pb2_grpc.MobileStub(intercept_channel) # enum = league_mobile_pb2.LeagueStatusEnum.Value( # 'ENDED' # ) # # print(enum) response = stub.GetMyLeagueRanking(league_mobile_pb2.LeagueIdStringRequest( league_id='1' )) print(response.error, response.ranking) # enum1 = league_mobile_pb2.LeagueTypeEnum.Value( # 'CASH_LEAGUE' # ) response2 = stub.GetActiveLeague(league_mobile_pb2.LeagueTypeRequest( league_type=league_mobile_pb2.UNKNOWN_LEAGUE_TYPE )) print(response2.error, response2.league_bucket) response3 = stub.GetMyActiveLeagueRanking(league_mobile_pb2.LeagueTypeRequest( league_type=league_mobile_pb2.CASH_LEAGUE )) print(response3.error, response3.ranking) response4 = stub.GetActiveLeagueRankings(league_mobile_pb2.GetActiveLeagueRankingsRequest( limit=1, next_page_token=None, league_type=league_mobile_pb2.CASH_LEAGUE )) print(response4.error, response4.league_bucket) response5 = stub.GetLeagueRankings(league_mobile_pb2.GetLeagueRankingsRequest( limit=1, next_page_token=None, league_id='2' )) print(response5.error, response5.league_bucket)
def campaign_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) # 调用 rpc 服务 stub = campaign_mobile_pb2_grpc.MobileStub(intercept_channel) response = stub.GetTimeLimitedDepositOptions(campaign_mobile_pb2.GetTimeLimitedDepositOptionsRequest( # The parameter can be null )) print(response.deposit_options) # Return an empty list response2 = stub.GetNotTimeLimitedDepositOptions(campaign_mobile_pb2.GetNonTimeLimitedDepositOptionsRequest( # The parameter can be null )) print(response2.deposit_options) # Return an empty list response3 = stub.GetAllEligibleDepositOptions(campaign_mobile_pb2.GetAllEligibleDepositOptionsRequest( # The parameter can be null )) print(response3.deposit_options) response4 = stub.GetDepositCampaignTaskOffer(campaign_mobile_pb2.GetDepositCampaignTaskOfferRequest( # The parameter can be null )) print(response4.err, response4.offer) # Returns an empty response5 = stub.QueryCampaignIsDepositable(campaign_mobile_pb2.QueryCampaignIsDepositableRequest( campaign_id='4' )) print(response5.err, response5.depositable) response6 = stub.DismissNotificationForCampaignOffer(campaign_mobile_pb2.DismissNotificationForCampaignOfferRequest( campaign_id='3' )) print(response6.err, response6.campaign_id) response7 = stub.MarkCampaignOfferPassed(campaign_mobile_pb2.MarkCampaignOfferPassedRequest( campaign_id='5' )) print(response7.err, response7.campaign_id)
def sale_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = sale_mobile_pb2_grpc.MobileStub(intercept_channel) response = stub.GetMyCoupons( sale_mobile_pb2.GetMyCouponsRequest(limit=2, next_page_token=bytes(123))) print(response.error, response.orders, response.next_page_token) response1 = stub.GetMyUsableCouponsByBucketId( sale_mobile_pb2.GetMyUsableCouponsByBucketIdRequest(bucket_id='')) print(response1.error, response1.orders) response2 = stub.GetSaleEvent(sale_mobile_pb2.GetSaleEventRequest()) print(response2.error, response2.sale_event) response3 = stub.GetSaleBundle( sale_mobile_pb2.GetSaleBundleRequest(bundle_id=1)) print(response3.error, response3.bundle)
def loyalty_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = loyalty_mobile_pb2_grpc.MobileStub(intercept_channel) response = stub.GetFirstGame( loyalty_mobile_pb2.GetFirstGameRequest(user_addr=addr, # auth='' )) print(response.error, response.got_reward, response.gain) response2 = stub.GetCheckin( loyalty_mobile_pb2.GetCheckinRequest(user_addr=addr, # auth='' )) print(response2.error, response2.has_checkin, response2.has_makeup, response2.start, response2.today, response2.now, response2.today_end, response2.days) response3 = stub.SubmitCheckin( loyalty_mobile_pb2.SubmitCheckinRequest(user_addr=addr, # auth='' )) print(response3.error, response3.got_reward, response3.reward) response4 = stub.ResetCheckin( loyalty_mobile_pb2.ResetCheckinRequest(user_addr=addr, # auth='' )) print(response4.error) response5 = stub.GetTasks( loyalty_mobile_pb2.GetTasksRequest(user_addr=addr, # auth='' )) print(response5.error, response5.tasks) response6 = stub.AcceptTask( loyalty_mobile_pb2.AcceptTaskRequest( user_addr=addr, # auth='' task_id=1)) print(response6.error, response6.started, response6.start, response6.deadline, response6.now) response7 = stub.AcceptAllTasks( loyalty_mobile_pb2.AcceptAllTasksRequest(user_addr=addr, # auth='' )) print(response7.error) response8 = stub.ClaimTask( loyalty_mobile_pb2.ClaimTaskRequest( user_addr=addr, # auth='' task_id=3)) print(response8.error, response8.got_reward, response8.gain, response8.reward) response9 = stub.GetRedeemTable( loyalty_mobile_pb2.GetRedeemTableRequest(user_addr=addr, # auth='' )) print(response9.error, response9.expiring_amount, response9.expiration, response9.entries) response10 = stub.Redeem( loyalty_mobile_pb2.RedeemRequest( user_addr=addr, # auth='', redeem_id=1, user_email='', # only needed if "id" is for physical reward proof=bytes( ), # redeem proof passed to bank (addr/amount/symbol/ts) proofts=1 # UTC timestamp (in seconds) used by the proof )) print(response10.error, response10.got_reward) response11 = stub.GetTier( loyalty_mobile_pb2.GetTierRequest(user_addr=addr, # auth='', )) print(response11.error, response11.tier, response11.icon, response11.multiplier, response11.year) response12 = stub.GetTiers(loyalty_mobile_pb2.GetTiersRequest()) print(response12.error, response12.entries) response13 = stub.ClaimFreeLootBox( loyalty_mobile_pb2.ClaimFreeLootBoxRequest(user_addr=addr, # auth='', )) print(response13.error, response13.options, response13.countdown_timer_duration) response14 = stub.GetDailyRewardsPreview( loyalty_mobile_pb2.GetDailyRewardsPreviewRequest(user_addr=addr, # auth='', )) print(response14.error, response14.daily_check_in_preview, response14.daily_tasks_preview, response14.free_loot_box_preview)
def config_API(): token = account_mobile_run.test_run() name = token_extract.header_adder_interceptor('authorization', '{}'.format(token)) channel = grpc.secure_channel('celerx-test.celer.app', public_key.public_key()) intercept_channel = grpc.intercept_channel(channel, name) stub = config_mobile_pb2_grpc.MobileStub(intercept_channel) response = stub.SetMarketingCampaignTag( config_mobile_pb2.SetMarketingCampaignTagRequest( marketing_campaign_tag='')) print(response.error) response2 = stub.SetABTestingExperimentTag( config_mobile_pb2.SetABTestingExperimentTagRequest( experiment_tag_name='', experiment_user_tag='')) print(response2.error) response3 = stub.GetGameInfoByGameID( config_mobile_pb2.GetGameInfoByGameIDRequest(game_id='000403')) print(response3.error, response3.game_info) response4 = stub.GetPracticeBucket( config_mobile_pb2.GetPracticeBucketRequest(game_id='000403')) print(response4.practice_bucket) response5 = stub.IsBlockedByDevice( config_mobile_pb2.IsBlockedByDeviceRequest(device_type='', device_id='')) print(response5.error, response5.is_blocked) response6 = stub.GetTournamentBuckets( config_mobile_pb2.GetTournamentBucketsRequest( game_id= '', # if this is not specified, return all tournaments for this app primary_account_type='', tournament_status='', # // could be # // "celerx.app" for Android or "network.celer.celerx" for iOS # // "celerx.app.solitaire" # // "celerx.app.fruitpunch" # // "celerx.app.cubematrix" # // "celerx.app.daubcash" app_id='', app_version='', device_type='')) print(response6.error, response6.tournament_bucket_detail_list) response7 = stub.GetGameBucketList( config_mobile_pb2.GetGameBucketListRequest( game_id='', primary_account_type='', tournament_status='', # // could be # // "celerx.app" for Android or "network.celer.celerx" for iOS # // "celerx.app.solitaire" # // "celerx.app.fruitpunch" # // "celerx.app.cubematrix" # // "celerx.app.daubcash" app_id='', app_version='', device_type='', need_special_bucket='')) print(response7.error, response7.match_buckets, response7.tournament_buckets, response7.special_buckets) response8 = stub.GetHomeNotifications( config_mobile_pb2.HomeNotificationRequest(primary_account_type='')) print(response8.error, response8.exists_unread_history, response8.exists_unclaimed_prize) response9 = stub.GetGameActivePlayersCount( config_mobile_pb2.GetGameActivePlayersCountRequest(game_ids='')) print(response9.active_players)