glitch-javascript-sdk 3.2.32 → 3.3.1
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/cjs/index.js +261 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Campaigns.d.ts +11 -0
- package/dist/esm/api/Multiplayer.d.ts +418 -0
- package/dist/esm/index.js +261 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +426 -0
- package/package.json +1 -1
- package/src/api/Campaigns.ts +15 -0
- package/src/api/Multiplayer.ts +517 -0
- package/src/routes/CampaignsRoute.ts +1 -0
- package/src/routes/MultiplayerRoute.ts +25 -0
package/dist/cjs/index.js
CHANGED
|
@@ -25231,6 +25231,7 @@ var CampaignsRoute = /** @class */ (function () {
|
|
|
25231
25231
|
createCampaignLink: { url: '/campaigns/{campaign_id}/links', method: HTTP_METHODS.POST },
|
|
25232
25232
|
getCampaignLink: { url: '/campaigns/{campaign_id}/links/{link_id}', method: HTTP_METHODS.GET },
|
|
25233
25233
|
updateCampaignLink: { url: '/campaigns/{campaign_id}/links/{link_id}', method: HTTP_METHODS.PUT },
|
|
25234
|
+
deleteCampaignLink: { url: '/campaigns/{campaign_id}/links/{link_id}', method: HTTP_METHODS.DELETE },
|
|
25234
25235
|
createInfluencerCampaign: { url: '/campaigns/{campaign_id}/influencers', method: HTTP_METHODS.POST },
|
|
25235
25236
|
listInfluencerCampaigns: { url: '/campaigns/influencers', method: HTTP_METHODS.GET },
|
|
25236
25237
|
getInfluencerCalendar: { url: '/campaigns/influencers/calendar', method: HTTP_METHODS.GET },
|
|
@@ -25500,6 +25501,19 @@ var Campaigns = /** @class */ (function () {
|
|
|
25500
25501
|
Campaigns.updateCampaignLink = function (campaign_id, link_id, data, params) {
|
|
25501
25502
|
return Requests.processRoute(CampaignsRoute.routes.updateCampaignLink, data, { campaign_id: campaign_id, link_id: link_id }, params);
|
|
25502
25503
|
};
|
|
25504
|
+
/**
|
|
25505
|
+
* Delete a campaign link.
|
|
25506
|
+
*
|
|
25507
|
+
* @see https://api.glitch.fun/api/documentation#/Campaigns/deleteCampaignLink
|
|
25508
|
+
*
|
|
25509
|
+
* @param campaign_id The id of the campaign to update.
|
|
25510
|
+
* @param link_id The id of the campaign link to delete.
|
|
25511
|
+
*
|
|
25512
|
+
* @returns promise
|
|
25513
|
+
*/
|
|
25514
|
+
Campaigns.deleteCampaignLink = function (campaign_id, link_id, params) {
|
|
25515
|
+
return Requests.processRoute(CampaignsRoute.routes.deleteCampaignLink, {}, { campaign_id: campaign_id, link_id: link_id }, params);
|
|
25516
|
+
};
|
|
25503
25517
|
/**
|
|
25504
25518
|
* Retrieve the information for a single campaign.
|
|
25505
25519
|
*
|
|
@@ -31056,6 +31070,28 @@ var MultiplayerRoute = /** @class */ (function () {
|
|
|
31056
31070
|
listFavorites: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.GET },
|
|
31057
31071
|
addFavorite: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.POST },
|
|
31058
31072
|
deleteFavorite: { url: '/titles/{title_id}/multiplayer/favorites/{favorite_id}', method: HTTP_METHODS.DELETE },
|
|
31073
|
+
// MMO world layer: realms, zones, instances, presence.
|
|
31074
|
+
listRealms: { url: '/titles/{title_id}/multiplayer/realms', method: HTTP_METHODS.GET },
|
|
31075
|
+
createRealm: { url: '/titles/{title_id}/multiplayer/realms', method: HTTP_METHODS.POST },
|
|
31076
|
+
showRealm: { url: '/titles/{title_id}/multiplayer/realms/{realm_id}', method: HTTP_METHODS.GET },
|
|
31077
|
+
updateRealm: { url: '/titles/{title_id}/multiplayer/realms/{realm_id}', method: HTTP_METHODS.PUT },
|
|
31078
|
+
listZones: { url: '/titles/{title_id}/multiplayer/realms/{realm_id}/zones', method: HTTP_METHODS.GET },
|
|
31079
|
+
createZone: { url: '/titles/{title_id}/multiplayer/realms/{realm_id}/zones', method: HTTP_METHODS.POST },
|
|
31080
|
+
listInstances: { url: '/titles/{title_id}/multiplayer/zones/{zone_id}/instances', method: HTTP_METHODS.GET },
|
|
31081
|
+
showInstance: { url: '/titles/{title_id}/multiplayer/instances/{instance_id}', method: HTTP_METHODS.GET },
|
|
31082
|
+
listInstancePresence: { url: '/titles/{title_id}/multiplayer/instances/{instance_id}/presence', method: HTTP_METHODS.GET },
|
|
31083
|
+
enterZone: { url: '/titles/{title_id}/multiplayer/world/enter', method: HTTP_METHODS.POST },
|
|
31084
|
+
updatePresence: { url: '/titles/{title_id}/multiplayer/world/presence', method: HTTP_METHODS.POST },
|
|
31085
|
+
leaveWorld: { url: '/titles/{title_id}/multiplayer/world/leave', method: HTTP_METHODS.POST },
|
|
31086
|
+
// Ticketed matchmaking.
|
|
31087
|
+
enqueueTicket: { url: '/titles/{title_id}/multiplayer/matchmaking/tickets', method: HTTP_METHODS.POST },
|
|
31088
|
+
showTicket: { url: '/titles/{title_id}/multiplayer/matchmaking/tickets/{ticket_id}', method: HTTP_METHODS.GET },
|
|
31089
|
+
cancelTicket: { url: '/titles/{title_id}/multiplayer/matchmaking/tickets/{ticket_id}', method: HTTP_METHODS.DELETE },
|
|
31090
|
+
// Real-time negotiate + trust/moderation.
|
|
31091
|
+
negotiateRealtime: { url: '/titles/{title_id}/multiplayer/realtime/negotiate', method: HTTP_METHODS.POST },
|
|
31092
|
+
listBans: { url: '/titles/{title_id}/multiplayer/bans', method: HTTP_METHODS.GET },
|
|
31093
|
+
createBan: { url: '/titles/{title_id}/multiplayer/bans', method: HTTP_METHODS.POST },
|
|
31094
|
+
deleteBan: { url: '/titles/{title_id}/multiplayer/bans/{ban_id}', method: HTTP_METHODS.DELETE },
|
|
31059
31095
|
};
|
|
31060
31096
|
return MultiplayerRoute;
|
|
31061
31097
|
}());
|
|
@@ -31556,6 +31592,231 @@ var Multiplayer = /** @class */ (function () {
|
|
|
31556
31592
|
Multiplayer.deleteFavorite = function (title_id, favorite_id, params) {
|
|
31557
31593
|
return Requests.processRoute(MultiplayerRoute.routes.deleteFavorite, undefined, { title_id: title_id, favorite_id: favorite_id }, params);
|
|
31558
31594
|
};
|
|
31595
|
+
// -----------------------------------------------------------------------
|
|
31596
|
+
// MMO world layer
|
|
31597
|
+
// -----------------------------------------------------------------------
|
|
31598
|
+
/**
|
|
31599
|
+
* List realms (persistent world shards) so a player can choose where to log in.
|
|
31600
|
+
*
|
|
31601
|
+
* @param title_id Title UUID.
|
|
31602
|
+
* @param params Optional region/status filters; recommended realms sort first.
|
|
31603
|
+
* @example
|
|
31604
|
+
* Multiplayer.listRealms('title-uuid', { region: 'us-central', status: 'active' });
|
|
31605
|
+
*/
|
|
31606
|
+
Multiplayer.listRealms = function (title_id, params) {
|
|
31607
|
+
return Requests.processRoute(MultiplayerRoute.routes.listRealms, undefined, { title_id: title_id }, params);
|
|
31608
|
+
};
|
|
31609
|
+
/**
|
|
31610
|
+
* Create a realm. Requires a title administrator JWT.
|
|
31611
|
+
*
|
|
31612
|
+
* @param title_id Title UUID.
|
|
31613
|
+
* @param data Realm configuration.
|
|
31614
|
+
* @example
|
|
31615
|
+
* Multiplayer.createRealm('title-uuid', { name: 'Aurora', region: 'us-central', population_cap: 5000, recommended: true });
|
|
31616
|
+
*/
|
|
31617
|
+
Multiplayer.createRealm = function (title_id, data) {
|
|
31618
|
+
return Requests.processRoute(MultiplayerRoute.routes.createRealm, data, { title_id: title_id });
|
|
31619
|
+
};
|
|
31620
|
+
/**
|
|
31621
|
+
* Retrieve a single realm.
|
|
31622
|
+
*
|
|
31623
|
+
* @param title_id Title UUID.
|
|
31624
|
+
* @param realm_id Realm UUID.
|
|
31625
|
+
*/
|
|
31626
|
+
Multiplayer.showRealm = function (title_id, realm_id) {
|
|
31627
|
+
return Requests.processRoute(MultiplayerRoute.routes.showRealm, undefined, { title_id: title_id, realm_id: realm_id });
|
|
31628
|
+
};
|
|
31629
|
+
/**
|
|
31630
|
+
* Update a realm (status, population cap, ruleset). Requires a title admin JWT.
|
|
31631
|
+
*
|
|
31632
|
+
* @param title_id Title UUID.
|
|
31633
|
+
* @param realm_id Realm UUID.
|
|
31634
|
+
* @param data Fields to update.
|
|
31635
|
+
*/
|
|
31636
|
+
Multiplayer.updateRealm = function (title_id, realm_id, data) {
|
|
31637
|
+
return Requests.processRoute(MultiplayerRoute.routes.updateRealm, data, { title_id: title_id, realm_id: realm_id });
|
|
31638
|
+
};
|
|
31639
|
+
/**
|
|
31640
|
+
* List the zones defined for a realm.
|
|
31641
|
+
*
|
|
31642
|
+
* @param title_id Title UUID.
|
|
31643
|
+
* @param realm_id Realm UUID.
|
|
31644
|
+
* @param params Optional zone_type filter.
|
|
31645
|
+
*/
|
|
31646
|
+
Multiplayer.listZones = function (title_id, realm_id, params) {
|
|
31647
|
+
return Requests.processRoute(MultiplayerRoute.routes.listZones, undefined, { title_id: title_id, realm_id: realm_id }, params);
|
|
31648
|
+
};
|
|
31649
|
+
/**
|
|
31650
|
+
* Create a zone in a realm. Requires a title administrator JWT.
|
|
31651
|
+
*
|
|
31652
|
+
* @param title_id Title UUID.
|
|
31653
|
+
* @param realm_id Realm UUID.
|
|
31654
|
+
* @param data Zone configuration, including interest-management grid cell size.
|
|
31655
|
+
* @example
|
|
31656
|
+
* Multiplayer.createZone('title-uuid', 'realm-uuid', {
|
|
31657
|
+
* zone_key: 'ashfall_valley',
|
|
31658
|
+
* display_name: 'Ashfall Valley',
|
|
31659
|
+
* zone_type: 'overworld',
|
|
31660
|
+
* max_players_per_instance: 100,
|
|
31661
|
+
* grid_cell_size: 64
|
|
31662
|
+
* });
|
|
31663
|
+
*/
|
|
31664
|
+
Multiplayer.createZone = function (title_id, realm_id, data) {
|
|
31665
|
+
return Requests.processRoute(MultiplayerRoute.routes.createZone, data, { title_id: title_id, realm_id: realm_id });
|
|
31666
|
+
};
|
|
31667
|
+
/**
|
|
31668
|
+
* List the active/other instances (runtime copies) of a zone.
|
|
31669
|
+
*
|
|
31670
|
+
* @param title_id Title UUID.
|
|
31671
|
+
* @param zone_id Zone UUID.
|
|
31672
|
+
* @param params Optional state filter.
|
|
31673
|
+
*/
|
|
31674
|
+
Multiplayer.listInstances = function (title_id, zone_id, params) {
|
|
31675
|
+
return Requests.processRoute(MultiplayerRoute.routes.listInstances, undefined, { title_id: title_id, zone_id: zone_id }, params);
|
|
31676
|
+
};
|
|
31677
|
+
/**
|
|
31678
|
+
* Retrieve a single instance.
|
|
31679
|
+
*
|
|
31680
|
+
* @param title_id Title UUID.
|
|
31681
|
+
* @param instance_id Instance UUID.
|
|
31682
|
+
*/
|
|
31683
|
+
Multiplayer.showInstance = function (title_id, instance_id) {
|
|
31684
|
+
return Requests.processRoute(MultiplayerRoute.routes.showInstance, undefined, { title_id: title_id, instance_id: instance_id });
|
|
31685
|
+
};
|
|
31686
|
+
/**
|
|
31687
|
+
* List players present in an instance. Pass grid_cell (and optional radius) to
|
|
31688
|
+
* receive only players in the caller's area of interest — the key to keeping
|
|
31689
|
+
* per-player fan-out bounded regardless of how populated the zone is.
|
|
31690
|
+
*
|
|
31691
|
+
* @param title_id Title UUID.
|
|
31692
|
+
* @param instance_id Instance UUID.
|
|
31693
|
+
* @param params grid_cell "cx:cy" and radius (0-4) to scope the query.
|
|
31694
|
+
* @example
|
|
31695
|
+
* Multiplayer.listInstancePresence('title-uuid', 'instance-uuid', { grid_cell: '12:8', radius: 1 });
|
|
31696
|
+
*/
|
|
31697
|
+
Multiplayer.listInstancePresence = function (title_id, instance_id, params) {
|
|
31698
|
+
return Requests.processRoute(MultiplayerRoute.routes.listInstancePresence, undefined, { title_id: title_id, instance_id: instance_id }, params);
|
|
31699
|
+
};
|
|
31700
|
+
/**
|
|
31701
|
+
* Enter a zone. The backend places the player into an active instance with
|
|
31702
|
+
* capacity (creating a new layer if all are full), enforces bans and realm
|
|
31703
|
+
* capacity, and upserts presence. Returns the instance and presence so the
|
|
31704
|
+
* client can connect and subscribe to the instance's real-time group.
|
|
31705
|
+
*
|
|
31706
|
+
* @param title_id Title UUID.
|
|
31707
|
+
* @param data Realm/zone target plus optional spawn position and metadata.
|
|
31708
|
+
* @example
|
|
31709
|
+
* Multiplayer.enterZone('title-uuid', {
|
|
31710
|
+
* player_id: 'steam:765...',
|
|
31711
|
+
* realm_id: 'realm-uuid',
|
|
31712
|
+
* zone_id: 'zone-uuid',
|
|
31713
|
+
* pos_x: 128.0, pos_z: 64.0
|
|
31714
|
+
* });
|
|
31715
|
+
*/
|
|
31716
|
+
Multiplayer.enterZone = function (title_id, data) {
|
|
31717
|
+
return Requests.processRoute(MultiplayerRoute.routes.enterZone, data, { title_id: title_id });
|
|
31718
|
+
};
|
|
31719
|
+
/**
|
|
31720
|
+
* Update presence (position, heading, rich status) and refresh the TTL. Call
|
|
31721
|
+
* on a movement interval and on notable state changes.
|
|
31722
|
+
*
|
|
31723
|
+
* @param title_id Title UUID.
|
|
31724
|
+
* @param data New position/status for the player.
|
|
31725
|
+
*/
|
|
31726
|
+
Multiplayer.updatePresence = function (title_id, data) {
|
|
31727
|
+
return Requests.processRoute(MultiplayerRoute.routes.updatePresence, data, { title_id: title_id });
|
|
31728
|
+
};
|
|
31729
|
+
/**
|
|
31730
|
+
* Leave the world. Frees the player's instance slot and realm population.
|
|
31731
|
+
*
|
|
31732
|
+
* @param title_id Title UUID.
|
|
31733
|
+
* @param data Optional player_id for title-token clients.
|
|
31734
|
+
*/
|
|
31735
|
+
Multiplayer.leaveWorld = function (title_id, data) {
|
|
31736
|
+
return Requests.processRoute(MultiplayerRoute.routes.leaveWorld, data, { title_id: title_id });
|
|
31737
|
+
};
|
|
31738
|
+
// -----------------------------------------------------------------------
|
|
31739
|
+
// Matchmaking
|
|
31740
|
+
// -----------------------------------------------------------------------
|
|
31741
|
+
/**
|
|
31742
|
+
* Enqueue a matchmaking ticket. Idempotent per (queue, player): an existing
|
|
31743
|
+
* open ticket is returned rather than duplicated, so retries are safe. Poll
|
|
31744
|
+
* the ticket or subscribe to `matchmaking.matched` for the assignment.
|
|
31745
|
+
*
|
|
31746
|
+
* @param title_id Title UUID.
|
|
31747
|
+
* @param data Queue name plus optional party, skill, region, and attributes.
|
|
31748
|
+
* @example
|
|
31749
|
+
* Multiplayer.enqueueTicket('title-uuid', { player_id: 'steam:765...', queue: 'ranked_2v2', skill: 1840, region: 'us-central' });
|
|
31750
|
+
*/
|
|
31751
|
+
Multiplayer.enqueueTicket = function (title_id, data) {
|
|
31752
|
+
return Requests.processRoute(MultiplayerRoute.routes.enqueueTicket, data, { title_id: title_id });
|
|
31753
|
+
};
|
|
31754
|
+
/**
|
|
31755
|
+
* Poll a matchmaking ticket. A queued ticket past its TTL is reported as
|
|
31756
|
+
* `timed_out`; a matched ticket carries the connection `assignment`.
|
|
31757
|
+
*
|
|
31758
|
+
* @param title_id Title UUID.
|
|
31759
|
+
* @param ticket_id Ticket UUID.
|
|
31760
|
+
*/
|
|
31761
|
+
Multiplayer.showTicket = function (title_id, ticket_id) {
|
|
31762
|
+
return Requests.processRoute(MultiplayerRoute.routes.showTicket, undefined, { title_id: title_id, ticket_id: ticket_id });
|
|
31763
|
+
};
|
|
31764
|
+
/**
|
|
31765
|
+
* Cancel a queued matchmaking ticket.
|
|
31766
|
+
*
|
|
31767
|
+
* @param title_id Title UUID.
|
|
31768
|
+
* @param ticket_id Ticket UUID.
|
|
31769
|
+
*/
|
|
31770
|
+
Multiplayer.cancelTicket = function (title_id, ticket_id) {
|
|
31771
|
+
return Requests.processRoute(MultiplayerRoute.routes.cancelTicket, undefined, { title_id: title_id, ticket_id: ticket_id });
|
|
31772
|
+
};
|
|
31773
|
+
// -----------------------------------------------------------------------
|
|
31774
|
+
// Real-time negotiate + trust/moderation
|
|
31775
|
+
// -----------------------------------------------------------------------
|
|
31776
|
+
/**
|
|
31777
|
+
* Negotiate a real-time push connection. Returns the authorized group names
|
|
31778
|
+
* and the push endpoint. When SignalR/Web PubSub is configured, an
|
|
31779
|
+
* access_token scoped to those groups is included; otherwise `configured` is
|
|
31780
|
+
* false and the client should fall back to the polling endpoints.
|
|
31781
|
+
*
|
|
31782
|
+
* @param title_id Title UUID.
|
|
31783
|
+
* @param data Optional player_id and the scopes (lobby/voice/zone/instance) to subscribe to.
|
|
31784
|
+
* @example
|
|
31785
|
+
* Multiplayer.negotiateRealtime('title-uuid', { player_id: 'steam:765...', scopes: [{ type: 'instance', id: 'instance-uuid' }] });
|
|
31786
|
+
*/
|
|
31787
|
+
Multiplayer.negotiateRealtime = function (title_id, data) {
|
|
31788
|
+
return Requests.processRoute(MultiplayerRoute.routes.negotiateRealtime, data, { title_id: title_id });
|
|
31789
|
+
};
|
|
31790
|
+
/**
|
|
31791
|
+
* List bans for a title. Requires a title administrator JWT.
|
|
31792
|
+
*
|
|
31793
|
+
* @param title_id Title UUID.
|
|
31794
|
+
* @param params Optional scope/player/source filters and active_only.
|
|
31795
|
+
*/
|
|
31796
|
+
Multiplayer.listBans = function (title_id, params) {
|
|
31797
|
+
return Requests.processRoute(MultiplayerRoute.routes.listBans, undefined, { title_id: title_id }, params);
|
|
31798
|
+
};
|
|
31799
|
+
/**
|
|
31800
|
+
* Ban a player at a scope (title/realm/lobby/server/voice). Requires a title
|
|
31801
|
+
* administrator JWT. Omit expires_at for a permanent ban.
|
|
31802
|
+
*
|
|
31803
|
+
* @param title_id Title UUID.
|
|
31804
|
+
* @param data Ban target and scope.
|
|
31805
|
+
* @example
|
|
31806
|
+
* Multiplayer.createBan('title-uuid', { player_id: 'steam:765...', scope: 'title', reason: 'Cheating: aimbot' });
|
|
31807
|
+
*/
|
|
31808
|
+
Multiplayer.createBan = function (title_id, data) {
|
|
31809
|
+
return Requests.processRoute(MultiplayerRoute.routes.createBan, data, { title_id: title_id });
|
|
31810
|
+
};
|
|
31811
|
+
/**
|
|
31812
|
+
* Lift a ban. Requires a title administrator JWT.
|
|
31813
|
+
*
|
|
31814
|
+
* @param title_id Title UUID.
|
|
31815
|
+
* @param ban_id Ban UUID.
|
|
31816
|
+
*/
|
|
31817
|
+
Multiplayer.deleteBan = function (title_id, ban_id) {
|
|
31818
|
+
return Requests.processRoute(MultiplayerRoute.routes.deleteBan, undefined, { title_id: title_id, ban_id: ban_id });
|
|
31819
|
+
};
|
|
31559
31820
|
return Multiplayer;
|
|
31560
31821
|
}());
|
|
31561
31822
|
|