Leave\Dismiss all current matches - Google play games services - google-play-games

How can I exit all the current matches (leave or dismiss) for a turnbased match. Basically I want all the current matches to be exited if a player exits multiplayer mode.
Thanks in advance

Use dismissMatch() to remove the matches all GoogleApiClient objects registered to the user.
Dismissing a match will not change the state of the match for other partcipants but dismissed matches will never be shown to the dismissing player again.
HTTP request
PUT https://www.googleapis.com/games/v1/turnbasedmatches/matchId/dismiss
Note that this request requires authorization with the following scope: https://developers.google.com/identity/protocols/OAuth2
https://www.googleapis.com/auth/games

Related

Receiving Golang GET request with # in the URL parameter

I'm trying to create a fulfillment app for shopify, and they send a call once an hour to an endpoint on my app, with the order names they need me to provide tracking numbers for.
Unfortunately the order names have "#" in them (ex. #1001.1). When I receive these calls the query arguments get cut off at the # and the rest of the query string no longer shows. When I remove the # from the call (while testing), the whole query string comes through.
With #'s
Request
GET http://localhost:4200/v1/fetch_tracking_numbers.json?order_names[]=#1001.1&order_names[]=#1002.1&order_names[]=#1003.2
Logged Request on server side
GET http://localhost:4200/v1/fetch_tracking_numbers.json?order_names[]=
Without #'s
Request
GET http://localhost:4200/v1/fetch_tracking_numbers.json?order_names[]=1001.1&order_names[]=1002.1&order_names[]=1003.2
Logged Request on server side
GET http://localhost:4200/v1/fetch_tracking_numbers.json?order_names[]=1001.1&order_names[]=1002.1&order_names[]=1003.2
I'm using atreugo built on top of fasthttp.
Thanks!
Just want to respond here with an update.
I'm an idiot.
Shopify encodes their request URI's.
Their docs mislead me, along with my stupidity. Thanks to everyone who tried to help!

Adding Mailchimp members as "Not-Subscribed" through API

In this article: https://mailchimp.com/help/about-your-contacts/ it lists the status options as:
Subscribed
Unsubscribed
Not-Subscribed
Cleaned
By passing in "subscribed" or "unsubscribed" as the status, this will update, however I cannot find a valid value to pass in for people who are Not-Subscribed.
"Pending" puts them into a pending state which triggers an email to be sent to the user to approve. The API doesn't allow you to leave it blank.
Is there a way to do this? In an ideal world, I want to allow the system calling the API to set subscribe/unsubscribe after further action from the user, while still initially adding them into the contacts list.
According to the Mailchimp API documentation, these are the only possible values for a subscriber's current status:
"subscribed"
"unsubscribed"
"cleaned"
"pending"
I suggest trying null if possible, or leaving the value empty as status= to see if that works. Otherwise, documentation is law.
Edit:
Untested, but you could also try passing an empty value using %02%03 as the contents of the value, given that %02 denotes the start of an ASCII character and %03 denotes the end of an ASCII Character. Success would depend on whether the Mailchimp server would allow it.

Loadster capturing rule found no matches for variable __RequestVerificationToken

I'm trying to stress test my application with Loadster but every single Post method throw warning/error __RequestVerificationToken is empty or undefined as in the Get method it has the warning about capturing rule found no matches for variable __RequestVerificationToken.
This is the default way to capture in the Get method
I tried these two capture ways as well to capture
<input name="__RequestVerificationToken" type="hidden" value="
and
<input name="__RequestVerificationToken" value="
as you can see here
but still having the same warnings.
by the way, I do have this key in the HTML file.
Any clue?
After you record a script, Loadster automatically adds capturing rules for some server-generated tokens, including __RequestVerificationToken, when it sees them regurgitated from the client to the server in a subsequent request. It does this by backtracking the graph of recorded requests/responses until it finds where they originated.
When Loadster's recorder finds a match for one of these tokens, it will create a capturer on the originating step (where the value was first seen in a response) and a parameterized variable in the subsequent step(s) where the value is returned to the server.
The important thing to keep in mind is that the capturing rule is based solely on information available at the time of recording. If something is different at playback, the capturer may fail to find a value, and you'll get this error.
The most likely explanation is that an earlier step in your script failed to produce the expected state, and now the server isn't actually returning the page with the __RequestVerificationToken. For example, an earlier login in your script may have failed, and now when you request the form you're getting some kind of error page instead of the form you expected.
You can confirm this in Loadster using the Requests tab at the bottom of the script editor. After playing a script, a tree of all requests and responses appears in this section, and you can drill down to see the exact response that your server returned. Most likely you won't see a __RequestVerificationToken in this response (that's why capturing failed) but you will probably see something else that explains it. You may also need to backtrack in the tree to an earlier request/response to see where it went off the rails.
For me, the place Loadster attached the "Capture" from the recording was not correct. After recording, it attached the "Capture" rule to the POST request that resulted from the form submission. The token to be captured though was actually generated by the preceding GET request.
To correct this, I simply moved (retyped) the Capture csrfmiddlewaretoken from HTML input csrfmiddlewaretoken from the POST request to the preceding GET and it worked.
This isn't actually the case for the OP, but search results for this error are slim, so this seemed like a good place to put this.

cypress record multiple url redirect after a click

I have a scenario where on clicking the submit button will redirect to /redirect1 page where we will be doing some validation and redirects automatically to /redirect2 and do some other validation and get redirects to the /success page.
I need to verify that on clicking submit button it moves to /redirect1 page and then to /redirect2 page and finally get landed to the /success page
How to automate this process using cypress
I like to be very specific about what I expect to happen so I usually do the following:
Arrange:
Specify the API endpoints you are about to call / need to wait for (this is not necessary but you can be sure the assertions won't run until the call resolves)
cy.server()
cy.route('POST', '**/registration').as('registerCall')
cy.route('POST', '**/verification').as('verifyCall')
(you can match the route by exact String, Glob or RegEx, https://docs.cypress.io/api/commands/route.html#Syntax)
Act:
Hit it off
cy.visit('/')
.getByText('Start the process')
.click()
Assert:
a) If you expect it to immediately redirect, assert for it
cy.url().should('eq', `${BASE_URL}/redirect1`)
or
b) If you are making the API call and redirecting only after that, let's wait for it to resolve and then assert. We specify the API call we're waiting for with the # followed by the alias we set above (cy.route(...).as(yourAlias)). I aliased my first API call as registerCall so we wait for that to resolve before making further assertions:
cy.wait('#registerCall')
cy.url().should('eq', `${BASE_URL}/redirect1`)
If you expect some text/loader to show up, check for it
cy.findByTestId('loader-component').should('be.visible')
cy.getByText(/^please wait$/i).should('be.visible')
Wait for the next API call, and check for route change after it
cy.wait('#verifyCall')
cy.url().should('eq', `${BASE_URL}/redirect2`)
... chain the rest of you assertions. This can go on forever.
Hope this helps, let me know if I made some things unclear!
P.S. the getByText (along with other cool selectors) comes from the cypress-testing-library which is built on top of the dom-testing-library and allows you to do navigate your application as a user would, i.e. mainly just by finding text.
If you know the URL(s) you could possibly do something like this
cy.url().should('include', '/redirect1');
cy.url().should('include', '/redirect2');
cy.url().should('include', '/success');
I am assuming it will try those and wait until they happen..

Google Play Games: different player ids

I use Games scope to login in my game (addScope(Games.SCOPE_GAMES)), and then call Games.getCurrentPlayerId(), which returns a string that contains digits only, and when I try to send a gift to this player from another, using Games.Requests.getSendIntent(), the request.getRecipients() returns an id string which is starting with 'g'. Why are the identifiers different?
According to the getCurrentPlayer reference,
this gets the current signed in player, if available. It is referring to a specific user.
However, getRecipients
retrieves the information about all the players that the request was sent to. So this is more than one user. GPGS has its own reasons why it starts with 'g'. You can also do your own naming convention if ever you come up with your own API.

Resources