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/esm/index.js
CHANGED
|
@@ -13233,6 +13233,7 @@ var CampaignsRoute = /** @class */ (function () {
|
|
|
13233
13233
|
createCampaignLink: { url: '/campaigns/{campaign_id}/links', method: HTTP_METHODS.POST },
|
|
13234
13234
|
getCampaignLink: { url: '/campaigns/{campaign_id}/links/{link_id}', method: HTTP_METHODS.GET },
|
|
13235
13235
|
updateCampaignLink: { url: '/campaigns/{campaign_id}/links/{link_id}', method: HTTP_METHODS.PUT },
|
|
13236
|
+
deleteCampaignLink: { url: '/campaigns/{campaign_id}/links/{link_id}', method: HTTP_METHODS.DELETE },
|
|
13236
13237
|
createInfluencerCampaign: { url: '/campaigns/{campaign_id}/influencers', method: HTTP_METHODS.POST },
|
|
13237
13238
|
listInfluencerCampaigns: { url: '/campaigns/influencers', method: HTTP_METHODS.GET },
|
|
13238
13239
|
getInfluencerCalendar: { url: '/campaigns/influencers/calendar', method: HTTP_METHODS.GET },
|
|
@@ -13502,6 +13503,19 @@ var Campaigns = /** @class */ (function () {
|
|
|
13502
13503
|
Campaigns.updateCampaignLink = function (campaign_id, link_id, data, params) {
|
|
13503
13504
|
return Requests.processRoute(CampaignsRoute.routes.updateCampaignLink, data, { campaign_id: campaign_id, link_id: link_id }, params);
|
|
13504
13505
|
};
|
|
13506
|
+
/**
|
|
13507
|
+
* Delete a campaign link.
|
|
13508
|
+
*
|
|
13509
|
+
* @see https://api.glitch.fun/api/documentation#/Campaigns/deleteCampaignLink
|
|
13510
|
+
*
|
|
13511
|
+
* @param campaign_id The id of the campaign to update.
|
|
13512
|
+
* @param link_id The id of the campaign link to delete.
|
|
13513
|
+
*
|
|
13514
|
+
* @returns promise
|
|
13515
|
+
*/
|
|
13516
|
+
Campaigns.deleteCampaignLink = function (campaign_id, link_id, params) {
|
|
13517
|
+
return Requests.processRoute(CampaignsRoute.routes.deleteCampaignLink, {}, { campaign_id: campaign_id, link_id: link_id }, params);
|
|
13518
|
+
};
|
|
13505
13519
|
/**
|
|
13506
13520
|
* Retrieve the information for a single campaign.
|
|
13507
13521
|
*
|
|
@@ -19058,6 +19072,28 @@ var MultiplayerRoute = /** @class */ (function () {
|
|
|
19058
19072
|
listFavorites: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.GET },
|
|
19059
19073
|
addFavorite: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.POST },
|
|
19060
19074
|
deleteFavorite: { url: '/titles/{title_id}/multiplayer/favorites/{favorite_id}', method: HTTP_METHODS.DELETE },
|
|
19075
|
+
// MMO world layer: realms, zones, instances, presence.
|
|
19076
|
+
listRealms: { url: '/titles/{title_id}/multiplayer/realms', method: HTTP_METHODS.GET },
|
|
19077
|
+
createRealm: { url: '/titles/{title_id}/multiplayer/realms', method: HTTP_METHODS.POST },
|
|
19078
|
+
showRealm: { url: '/titles/{title_id}/multiplayer/realms/{realm_id}', method: HTTP_METHODS.GET },
|
|
19079
|
+
updateRealm: { url: '/titles/{title_id}/multiplayer/realms/{realm_id}', method: HTTP_METHODS.PUT },
|
|
19080
|
+
listZones: { url: '/titles/{title_id}/multiplayer/realms/{realm_id}/zones', method: HTTP_METHODS.GET },
|
|
19081
|
+
createZone: { url: '/titles/{title_id}/multiplayer/realms/{realm_id}/zones', method: HTTP_METHODS.POST },
|
|
19082
|
+
listInstances: { url: '/titles/{title_id}/multiplayer/zones/{zone_id}/instances', method: HTTP_METHODS.GET },
|
|
19083
|
+
showInstance: { url: '/titles/{title_id}/multiplayer/instances/{instance_id}', method: HTTP_METHODS.GET },
|
|
19084
|
+
listInstancePresence: { url: '/titles/{title_id}/multiplayer/instances/{instance_id}/presence', method: HTTP_METHODS.GET },
|
|
19085
|
+
enterZone: { url: '/titles/{title_id}/multiplayer/world/enter', method: HTTP_METHODS.POST },
|
|
19086
|
+
updatePresence: { url: '/titles/{title_id}/multiplayer/world/presence', method: HTTP_METHODS.POST },
|
|
19087
|
+
leaveWorld: { url: '/titles/{title_id}/multiplayer/world/leave', method: HTTP_METHODS.POST },
|
|
19088
|
+
// Ticketed matchmaking.
|
|
19089
|
+
enqueueTicket: { url: '/titles/{title_id}/multiplayer/matchmaking/tickets', method: HTTP_METHODS.POST },
|
|
19090
|
+
showTicket: { url: '/titles/{title_id}/multiplayer/matchmaking/tickets/{ticket_id}', method: HTTP_METHODS.GET },
|
|
19091
|
+
cancelTicket: { url: '/titles/{title_id}/multiplayer/matchmaking/tickets/{ticket_id}', method: HTTP_METHODS.DELETE },
|
|
19092
|
+
// Real-time negotiate + trust/moderation.
|
|
19093
|
+
negotiateRealtime: { url: '/titles/{title_id}/multiplayer/realtime/negotiate', method: HTTP_METHODS.POST },
|
|
19094
|
+
listBans: { url: '/titles/{title_id}/multiplayer/bans', method: HTTP_METHODS.GET },
|
|
19095
|
+
createBan: { url: '/titles/{title_id}/multiplayer/bans', method: HTTP_METHODS.POST },
|
|
19096
|
+
deleteBan: { url: '/titles/{title_id}/multiplayer/bans/{ban_id}', method: HTTP_METHODS.DELETE },
|
|
19061
19097
|
};
|
|
19062
19098
|
return MultiplayerRoute;
|
|
19063
19099
|
}());
|
|
@@ -19558,6 +19594,231 @@ var Multiplayer = /** @class */ (function () {
|
|
|
19558
19594
|
Multiplayer.deleteFavorite = function (title_id, favorite_id, params) {
|
|
19559
19595
|
return Requests.processRoute(MultiplayerRoute.routes.deleteFavorite, undefined, { title_id: title_id, favorite_id: favorite_id }, params);
|
|
19560
19596
|
};
|
|
19597
|
+
// -----------------------------------------------------------------------
|
|
19598
|
+
// MMO world layer
|
|
19599
|
+
// -----------------------------------------------------------------------
|
|
19600
|
+
/**
|
|
19601
|
+
* List realms (persistent world shards) so a player can choose where to log in.
|
|
19602
|
+
*
|
|
19603
|
+
* @param title_id Title UUID.
|
|
19604
|
+
* @param params Optional region/status filters; recommended realms sort first.
|
|
19605
|
+
* @example
|
|
19606
|
+
* Multiplayer.listRealms('title-uuid', { region: 'us-central', status: 'active' });
|
|
19607
|
+
*/
|
|
19608
|
+
Multiplayer.listRealms = function (title_id, params) {
|
|
19609
|
+
return Requests.processRoute(MultiplayerRoute.routes.listRealms, undefined, { title_id: title_id }, params);
|
|
19610
|
+
};
|
|
19611
|
+
/**
|
|
19612
|
+
* Create a realm. Requires a title administrator JWT.
|
|
19613
|
+
*
|
|
19614
|
+
* @param title_id Title UUID.
|
|
19615
|
+
* @param data Realm configuration.
|
|
19616
|
+
* @example
|
|
19617
|
+
* Multiplayer.createRealm('title-uuid', { name: 'Aurora', region: 'us-central', population_cap: 5000, recommended: true });
|
|
19618
|
+
*/
|
|
19619
|
+
Multiplayer.createRealm = function (title_id, data) {
|
|
19620
|
+
return Requests.processRoute(MultiplayerRoute.routes.createRealm, data, { title_id: title_id });
|
|
19621
|
+
};
|
|
19622
|
+
/**
|
|
19623
|
+
* Retrieve a single realm.
|
|
19624
|
+
*
|
|
19625
|
+
* @param title_id Title UUID.
|
|
19626
|
+
* @param realm_id Realm UUID.
|
|
19627
|
+
*/
|
|
19628
|
+
Multiplayer.showRealm = function (title_id, realm_id) {
|
|
19629
|
+
return Requests.processRoute(MultiplayerRoute.routes.showRealm, undefined, { title_id: title_id, realm_id: realm_id });
|
|
19630
|
+
};
|
|
19631
|
+
/**
|
|
19632
|
+
* Update a realm (status, population cap, ruleset). Requires a title admin JWT.
|
|
19633
|
+
*
|
|
19634
|
+
* @param title_id Title UUID.
|
|
19635
|
+
* @param realm_id Realm UUID.
|
|
19636
|
+
* @param data Fields to update.
|
|
19637
|
+
*/
|
|
19638
|
+
Multiplayer.updateRealm = function (title_id, realm_id, data) {
|
|
19639
|
+
return Requests.processRoute(MultiplayerRoute.routes.updateRealm, data, { title_id: title_id, realm_id: realm_id });
|
|
19640
|
+
};
|
|
19641
|
+
/**
|
|
19642
|
+
* List the zones defined for a realm.
|
|
19643
|
+
*
|
|
19644
|
+
* @param title_id Title UUID.
|
|
19645
|
+
* @param realm_id Realm UUID.
|
|
19646
|
+
* @param params Optional zone_type filter.
|
|
19647
|
+
*/
|
|
19648
|
+
Multiplayer.listZones = function (title_id, realm_id, params) {
|
|
19649
|
+
return Requests.processRoute(MultiplayerRoute.routes.listZones, undefined, { title_id: title_id, realm_id: realm_id }, params);
|
|
19650
|
+
};
|
|
19651
|
+
/**
|
|
19652
|
+
* Create a zone in a realm. Requires a title administrator JWT.
|
|
19653
|
+
*
|
|
19654
|
+
* @param title_id Title UUID.
|
|
19655
|
+
* @param realm_id Realm UUID.
|
|
19656
|
+
* @param data Zone configuration, including interest-management grid cell size.
|
|
19657
|
+
* @example
|
|
19658
|
+
* Multiplayer.createZone('title-uuid', 'realm-uuid', {
|
|
19659
|
+
* zone_key: 'ashfall_valley',
|
|
19660
|
+
* display_name: 'Ashfall Valley',
|
|
19661
|
+
* zone_type: 'overworld',
|
|
19662
|
+
* max_players_per_instance: 100,
|
|
19663
|
+
* grid_cell_size: 64
|
|
19664
|
+
* });
|
|
19665
|
+
*/
|
|
19666
|
+
Multiplayer.createZone = function (title_id, realm_id, data) {
|
|
19667
|
+
return Requests.processRoute(MultiplayerRoute.routes.createZone, data, { title_id: title_id, realm_id: realm_id });
|
|
19668
|
+
};
|
|
19669
|
+
/**
|
|
19670
|
+
* List the active/other instances (runtime copies) of a zone.
|
|
19671
|
+
*
|
|
19672
|
+
* @param title_id Title UUID.
|
|
19673
|
+
* @param zone_id Zone UUID.
|
|
19674
|
+
* @param params Optional state filter.
|
|
19675
|
+
*/
|
|
19676
|
+
Multiplayer.listInstances = function (title_id, zone_id, params) {
|
|
19677
|
+
return Requests.processRoute(MultiplayerRoute.routes.listInstances, undefined, { title_id: title_id, zone_id: zone_id }, params);
|
|
19678
|
+
};
|
|
19679
|
+
/**
|
|
19680
|
+
* Retrieve a single instance.
|
|
19681
|
+
*
|
|
19682
|
+
* @param title_id Title UUID.
|
|
19683
|
+
* @param instance_id Instance UUID.
|
|
19684
|
+
*/
|
|
19685
|
+
Multiplayer.showInstance = function (title_id, instance_id) {
|
|
19686
|
+
return Requests.processRoute(MultiplayerRoute.routes.showInstance, undefined, { title_id: title_id, instance_id: instance_id });
|
|
19687
|
+
};
|
|
19688
|
+
/**
|
|
19689
|
+
* List players present in an instance. Pass grid_cell (and optional radius) to
|
|
19690
|
+
* receive only players in the caller's area of interest — the key to keeping
|
|
19691
|
+
* per-player fan-out bounded regardless of how populated the zone is.
|
|
19692
|
+
*
|
|
19693
|
+
* @param title_id Title UUID.
|
|
19694
|
+
* @param instance_id Instance UUID.
|
|
19695
|
+
* @param params grid_cell "cx:cy" and radius (0-4) to scope the query.
|
|
19696
|
+
* @example
|
|
19697
|
+
* Multiplayer.listInstancePresence('title-uuid', 'instance-uuid', { grid_cell: '12:8', radius: 1 });
|
|
19698
|
+
*/
|
|
19699
|
+
Multiplayer.listInstancePresence = function (title_id, instance_id, params) {
|
|
19700
|
+
return Requests.processRoute(MultiplayerRoute.routes.listInstancePresence, undefined, { title_id: title_id, instance_id: instance_id }, params);
|
|
19701
|
+
};
|
|
19702
|
+
/**
|
|
19703
|
+
* Enter a zone. The backend places the player into an active instance with
|
|
19704
|
+
* capacity (creating a new layer if all are full), enforces bans and realm
|
|
19705
|
+
* capacity, and upserts presence. Returns the instance and presence so the
|
|
19706
|
+
* client can connect and subscribe to the instance's real-time group.
|
|
19707
|
+
*
|
|
19708
|
+
* @param title_id Title UUID.
|
|
19709
|
+
* @param data Realm/zone target plus optional spawn position and metadata.
|
|
19710
|
+
* @example
|
|
19711
|
+
* Multiplayer.enterZone('title-uuid', {
|
|
19712
|
+
* player_id: 'steam:765...',
|
|
19713
|
+
* realm_id: 'realm-uuid',
|
|
19714
|
+
* zone_id: 'zone-uuid',
|
|
19715
|
+
* pos_x: 128.0, pos_z: 64.0
|
|
19716
|
+
* });
|
|
19717
|
+
*/
|
|
19718
|
+
Multiplayer.enterZone = function (title_id, data) {
|
|
19719
|
+
return Requests.processRoute(MultiplayerRoute.routes.enterZone, data, { title_id: title_id });
|
|
19720
|
+
};
|
|
19721
|
+
/**
|
|
19722
|
+
* Update presence (position, heading, rich status) and refresh the TTL. Call
|
|
19723
|
+
* on a movement interval and on notable state changes.
|
|
19724
|
+
*
|
|
19725
|
+
* @param title_id Title UUID.
|
|
19726
|
+
* @param data New position/status for the player.
|
|
19727
|
+
*/
|
|
19728
|
+
Multiplayer.updatePresence = function (title_id, data) {
|
|
19729
|
+
return Requests.processRoute(MultiplayerRoute.routes.updatePresence, data, { title_id: title_id });
|
|
19730
|
+
};
|
|
19731
|
+
/**
|
|
19732
|
+
* Leave the world. Frees the player's instance slot and realm population.
|
|
19733
|
+
*
|
|
19734
|
+
* @param title_id Title UUID.
|
|
19735
|
+
* @param data Optional player_id for title-token clients.
|
|
19736
|
+
*/
|
|
19737
|
+
Multiplayer.leaveWorld = function (title_id, data) {
|
|
19738
|
+
return Requests.processRoute(MultiplayerRoute.routes.leaveWorld, data, { title_id: title_id });
|
|
19739
|
+
};
|
|
19740
|
+
// -----------------------------------------------------------------------
|
|
19741
|
+
// Matchmaking
|
|
19742
|
+
// -----------------------------------------------------------------------
|
|
19743
|
+
/**
|
|
19744
|
+
* Enqueue a matchmaking ticket. Idempotent per (queue, player): an existing
|
|
19745
|
+
* open ticket is returned rather than duplicated, so retries are safe. Poll
|
|
19746
|
+
* the ticket or subscribe to `matchmaking.matched` for the assignment.
|
|
19747
|
+
*
|
|
19748
|
+
* @param title_id Title UUID.
|
|
19749
|
+
* @param data Queue name plus optional party, skill, region, and attributes.
|
|
19750
|
+
* @example
|
|
19751
|
+
* Multiplayer.enqueueTicket('title-uuid', { player_id: 'steam:765...', queue: 'ranked_2v2', skill: 1840, region: 'us-central' });
|
|
19752
|
+
*/
|
|
19753
|
+
Multiplayer.enqueueTicket = function (title_id, data) {
|
|
19754
|
+
return Requests.processRoute(MultiplayerRoute.routes.enqueueTicket, data, { title_id: title_id });
|
|
19755
|
+
};
|
|
19756
|
+
/**
|
|
19757
|
+
* Poll a matchmaking ticket. A queued ticket past its TTL is reported as
|
|
19758
|
+
* `timed_out`; a matched ticket carries the connection `assignment`.
|
|
19759
|
+
*
|
|
19760
|
+
* @param title_id Title UUID.
|
|
19761
|
+
* @param ticket_id Ticket UUID.
|
|
19762
|
+
*/
|
|
19763
|
+
Multiplayer.showTicket = function (title_id, ticket_id) {
|
|
19764
|
+
return Requests.processRoute(MultiplayerRoute.routes.showTicket, undefined, { title_id: title_id, ticket_id: ticket_id });
|
|
19765
|
+
};
|
|
19766
|
+
/**
|
|
19767
|
+
* Cancel a queued matchmaking ticket.
|
|
19768
|
+
*
|
|
19769
|
+
* @param title_id Title UUID.
|
|
19770
|
+
* @param ticket_id Ticket UUID.
|
|
19771
|
+
*/
|
|
19772
|
+
Multiplayer.cancelTicket = function (title_id, ticket_id) {
|
|
19773
|
+
return Requests.processRoute(MultiplayerRoute.routes.cancelTicket, undefined, { title_id: title_id, ticket_id: ticket_id });
|
|
19774
|
+
};
|
|
19775
|
+
// -----------------------------------------------------------------------
|
|
19776
|
+
// Real-time negotiate + trust/moderation
|
|
19777
|
+
// -----------------------------------------------------------------------
|
|
19778
|
+
/**
|
|
19779
|
+
* Negotiate a real-time push connection. Returns the authorized group names
|
|
19780
|
+
* and the push endpoint. When SignalR/Web PubSub is configured, an
|
|
19781
|
+
* access_token scoped to those groups is included; otherwise `configured` is
|
|
19782
|
+
* false and the client should fall back to the polling endpoints.
|
|
19783
|
+
*
|
|
19784
|
+
* @param title_id Title UUID.
|
|
19785
|
+
* @param data Optional player_id and the scopes (lobby/voice/zone/instance) to subscribe to.
|
|
19786
|
+
* @example
|
|
19787
|
+
* Multiplayer.negotiateRealtime('title-uuid', { player_id: 'steam:765...', scopes: [{ type: 'instance', id: 'instance-uuid' }] });
|
|
19788
|
+
*/
|
|
19789
|
+
Multiplayer.negotiateRealtime = function (title_id, data) {
|
|
19790
|
+
return Requests.processRoute(MultiplayerRoute.routes.negotiateRealtime, data, { title_id: title_id });
|
|
19791
|
+
};
|
|
19792
|
+
/**
|
|
19793
|
+
* List bans for a title. Requires a title administrator JWT.
|
|
19794
|
+
*
|
|
19795
|
+
* @param title_id Title UUID.
|
|
19796
|
+
* @param params Optional scope/player/source filters and active_only.
|
|
19797
|
+
*/
|
|
19798
|
+
Multiplayer.listBans = function (title_id, params) {
|
|
19799
|
+
return Requests.processRoute(MultiplayerRoute.routes.listBans, undefined, { title_id: title_id }, params);
|
|
19800
|
+
};
|
|
19801
|
+
/**
|
|
19802
|
+
* Ban a player at a scope (title/realm/lobby/server/voice). Requires a title
|
|
19803
|
+
* administrator JWT. Omit expires_at for a permanent ban.
|
|
19804
|
+
*
|
|
19805
|
+
* @param title_id Title UUID.
|
|
19806
|
+
* @param data Ban target and scope.
|
|
19807
|
+
* @example
|
|
19808
|
+
* Multiplayer.createBan('title-uuid', { player_id: 'steam:765...', scope: 'title', reason: 'Cheating: aimbot' });
|
|
19809
|
+
*/
|
|
19810
|
+
Multiplayer.createBan = function (title_id, data) {
|
|
19811
|
+
return Requests.processRoute(MultiplayerRoute.routes.createBan, data, { title_id: title_id });
|
|
19812
|
+
};
|
|
19813
|
+
/**
|
|
19814
|
+
* Lift a ban. Requires a title administrator JWT.
|
|
19815
|
+
*
|
|
19816
|
+
* @param title_id Title UUID.
|
|
19817
|
+
* @param ban_id Ban UUID.
|
|
19818
|
+
*/
|
|
19819
|
+
Multiplayer.deleteBan = function (title_id, ban_id) {
|
|
19820
|
+
return Requests.processRoute(MultiplayerRoute.routes.deleteBan, undefined, { title_id: title_id, ban_id: ban_id });
|
|
19821
|
+
};
|
|
19561
19822
|
return Multiplayer;
|
|
19562
19823
|
}());
|
|
19563
19824
|
|