@zyphr-dev/node-sdk 0.1.38 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +72 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/.openapi-generator/FILES +1 -0
- package/src/src/apis/AuthRegistrationApi.ts +65 -0
- package/src/src/models/SignInWithGooglePlayGamesRequest.ts +66 -0
- package/src/src/models/index.ts +1 -0
package/package.json
CHANGED
|
@@ -321,6 +321,7 @@ src/models/SetPreferencesRequest.ts
|
|
|
321
321
|
src/models/SetPreferencesRequestPreferencesInner.ts
|
|
322
322
|
src/models/SignInAnonymouslyRequest.ts
|
|
323
323
|
src/models/SignInWithGameCenterRequest.ts
|
|
324
|
+
src/models/SignInWithGooglePlayGamesRequest.ts
|
|
324
325
|
src/models/SlackMessage.ts
|
|
325
326
|
src/models/SlackMessageListResponse.ts
|
|
326
327
|
src/models/SlackMessageListResponseMeta.ts
|
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
RegisterRequest,
|
|
22
22
|
SignInAnonymouslyRequest,
|
|
23
23
|
SignInWithGameCenterRequest,
|
|
24
|
+
SignInWithGooglePlayGamesRequest,
|
|
24
25
|
} from '../models/index';
|
|
25
26
|
import {
|
|
26
27
|
ApiErrorFromJSON,
|
|
@@ -35,6 +36,8 @@ import {
|
|
|
35
36
|
SignInAnonymouslyRequestToJSON,
|
|
36
37
|
SignInWithGameCenterRequestFromJSON,
|
|
37
38
|
SignInWithGameCenterRequestToJSON,
|
|
39
|
+
SignInWithGooglePlayGamesRequestFromJSON,
|
|
40
|
+
SignInWithGooglePlayGamesRequestToJSON,
|
|
38
41
|
} from '../models/index';
|
|
39
42
|
|
|
40
43
|
export interface AuthRegistrationApiConvertAnonymousUserOperationRequest {
|
|
@@ -53,6 +56,10 @@ export interface AuthRegistrationApiSignInWithGameCenterOperationRequest {
|
|
|
53
56
|
signInWithGameCenterRequest: SignInWithGameCenterRequest;
|
|
54
57
|
}
|
|
55
58
|
|
|
59
|
+
export interface AuthRegistrationApiSignInWithGooglePlayGamesOperationRequest {
|
|
60
|
+
signInWithGooglePlayGamesRequest: SignInWithGooglePlayGamesRequest;
|
|
61
|
+
}
|
|
62
|
+
|
|
56
63
|
/**
|
|
57
64
|
* AuthRegistrationApi - interface
|
|
58
65
|
*
|
|
@@ -124,6 +131,22 @@ export interface AuthRegistrationApiInterface {
|
|
|
124
131
|
*/
|
|
125
132
|
signInWithGameCenter(signInWithGameCenterRequest: SignInWithGameCenterRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse>;
|
|
126
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google\'s OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer\'s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr\'s own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
136
|
+
* @summary Sign in with Google Play Games Services
|
|
137
|
+
* @param {SignInWithGooglePlayGamesRequest} signInWithGooglePlayGamesRequest
|
|
138
|
+
* @param {*} [options] Override http request option.
|
|
139
|
+
* @throws {RequiredError}
|
|
140
|
+
* @memberof AuthRegistrationApiInterface
|
|
141
|
+
*/
|
|
142
|
+
signInWithGooglePlayGamesRaw(requestParameters: AuthRegistrationApiSignInWithGooglePlayGamesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>>;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google\'s OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer\'s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr\'s own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
146
|
+
* Sign in with Google Play Games Services
|
|
147
|
+
*/
|
|
148
|
+
signInWithGooglePlayGames(signInWithGooglePlayGamesRequest: SignInWithGooglePlayGamesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse>;
|
|
149
|
+
|
|
127
150
|
}
|
|
128
151
|
|
|
129
152
|
/**
|
|
@@ -299,4 +322,46 @@ export class AuthRegistrationApi extends runtime.BaseAPI implements AuthRegistra
|
|
|
299
322
|
return await response.value();
|
|
300
323
|
}
|
|
301
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google\'s OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer\'s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr\'s own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
327
|
+
* Sign in with Google Play Games Services
|
|
328
|
+
*/
|
|
329
|
+
async signInWithGooglePlayGamesRaw(requestParameters: AuthRegistrationApiSignInWithGooglePlayGamesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>> {
|
|
330
|
+
if (requestParameters['signInWithGooglePlayGamesRequest'] == null) {
|
|
331
|
+
throw new runtime.RequiredError(
|
|
332
|
+
'signInWithGooglePlayGamesRequest',
|
|
333
|
+
'Required parameter "signInWithGooglePlayGamesRequest" was null or undefined when calling signInWithGooglePlayGames().'
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const queryParameters: any = {};
|
|
338
|
+
|
|
339
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
340
|
+
|
|
341
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
342
|
+
|
|
343
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
344
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const response = await this.request({
|
|
348
|
+
path: `/auth/google-play-games`,
|
|
349
|
+
method: 'POST',
|
|
350
|
+
headers: headerParameters,
|
|
351
|
+
query: queryParameters,
|
|
352
|
+
body: SignInWithGooglePlayGamesRequestToJSON(requestParameters['signInWithGooglePlayGamesRequest']),
|
|
353
|
+
}, initOverrides);
|
|
354
|
+
|
|
355
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google\'s OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer\'s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr\'s own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
360
|
+
* Sign in with Google Play Games Services
|
|
361
|
+
*/
|
|
362
|
+
async signInWithGooglePlayGames(signInWithGooglePlayGamesRequest: SignInWithGooglePlayGamesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse> {
|
|
363
|
+
const response = await this.signInWithGooglePlayGamesRaw({ signInWithGooglePlayGamesRequest: signInWithGooglePlayGamesRequest }, initOverrides);
|
|
364
|
+
return await response.value();
|
|
365
|
+
}
|
|
366
|
+
|
|
302
367
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Zyphr API
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@zyphr.dev
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @interface SignInWithGooglePlayGamesRequest
|
|
20
|
+
*/
|
|
21
|
+
export interface SignInWithGooglePlayGamesRequest {
|
|
22
|
+
/**
|
|
23
|
+
* The single-use server auth code from GamesSignInClient.requestServerSideAccess (obtained with the game's web/server client id). Zyphr exchanges it server-side; a client-supplied player id is neither accepted nor trusted.
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof SignInWithGooglePlayGamesRequest
|
|
26
|
+
*/
|
|
27
|
+
serverAuthCode: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Check if a given object implements the SignInWithGooglePlayGamesRequest interface.
|
|
32
|
+
*/
|
|
33
|
+
export function instanceOfSignInWithGooglePlayGamesRequest(value: object): value is SignInWithGooglePlayGamesRequest {
|
|
34
|
+
if (!('serverAuthCode' in value) || value['serverAuthCode'] === undefined) return false;
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function SignInWithGooglePlayGamesRequestFromJSON(json: any): SignInWithGooglePlayGamesRequest {
|
|
39
|
+
return SignInWithGooglePlayGamesRequestFromJSONTyped(json, false);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function SignInWithGooglePlayGamesRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SignInWithGooglePlayGamesRequest {
|
|
43
|
+
if (json == null) {
|
|
44
|
+
return json;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
|
|
48
|
+
'serverAuthCode': json['serverAuthCode'],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function SignInWithGooglePlayGamesRequestToJSON(json: any): SignInWithGooglePlayGamesRequest {
|
|
53
|
+
return SignInWithGooglePlayGamesRequestToJSONTyped(json, false);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function SignInWithGooglePlayGamesRequestToJSONTyped(value?: SignInWithGooglePlayGamesRequest | null, ignoreDiscriminator: boolean = false): any {
|
|
57
|
+
if (value == null) {
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
|
|
63
|
+
'serverAuthCode': value['serverAuthCode'],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
package/src/src/models/index.ts
CHANGED
|
@@ -281,6 +281,7 @@ export * from './SetPreferencesRequest';
|
|
|
281
281
|
export * from './SetPreferencesRequestPreferencesInner';
|
|
282
282
|
export * from './SignInAnonymouslyRequest';
|
|
283
283
|
export * from './SignInWithGameCenterRequest';
|
|
284
|
+
export * from './SignInWithGooglePlayGamesRequest';
|
|
284
285
|
export * from './SlackMessage';
|
|
285
286
|
export * from './SlackMessageListResponse';
|
|
286
287
|
export * from './SlackMessageListResponseMeta';
|