@cstar.help/js 0.17.2 → 0.17.4

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.js CHANGED
@@ -237,7 +237,7 @@ function parseError(statusCode, body, retryAfter) {
237
237
  }
238
238
 
239
239
  // src/client.ts
240
- var SDK_VERSION = "0.17.2";
240
+ var SDK_VERSION = "0.17.4";
241
241
  var DEFAULT_BASE_URL = "https://www.cstar.help";
242
242
  var DEFAULT_API_VERSION = "2026-03-01";
243
243
  var DEFAULT_MAX_RETRIES = 3;
@@ -343,8 +343,13 @@ var HttpClient = class {
343
343
  }
344
344
  if (response.ok) {
345
345
  if (response.status === 204) return void 0;
346
- const json = await response.json();
347
346
  const headerRequestId = response.headers.get("x-request-id") ?? response.headers.get("x-cstar-request-id");
347
+ if (options?.responseType === "text") {
348
+ const text = await response.text();
349
+ this.captureMeta(null, headerRequestId);
350
+ return text;
351
+ }
352
+ const json = await response.json();
348
353
  this.captureMeta(json, headerRequestId);
349
354
  return this.unwrapEnvelope(json);
350
355
  }
@@ -1454,11 +1459,9 @@ var QuickRepliesResource = class {
1454
1459
  }
1455
1460
  /** Reorder quick replies. */
1456
1461
  async reorder(orderedIds) {
1457
- return this.client.request(
1458
- "PUT",
1459
- "/settings/quick-replies/reorder",
1460
- { body: { orderedIds } }
1461
- );
1462
+ return this.client.request("PUT", "/settings/quick-replies/reorder", {
1463
+ body: { orderedIds }
1464
+ });
1462
1465
  }
1463
1466
  };
1464
1467
  var SettingsResource = class {
@@ -1632,9 +1635,13 @@ var CustomFieldsResource = class {
1632
1635
  }
1633
1636
  /** Reorder custom fields within a content type. */
1634
1637
  async reorder(contentType, orderedIds) {
1635
- return this.client.request("PUT", "/custom-fields/reorder", {
1636
- body: { contentType, orderedIds }
1637
- });
1638
+ return this.client.request(
1639
+ "PUT",
1640
+ "/custom-fields/reorder",
1641
+ {
1642
+ body: { contentType, orderedIds }
1643
+ }
1644
+ );
1638
1645
  }
1639
1646
  };
1640
1647
 
@@ -1769,11 +1776,11 @@ var ExportResource = class {
1769
1776
  constructor(client) {
1770
1777
  this.client = client;
1771
1778
  }
1772
- /** Create an export. Returns exported data synchronously. */
1773
1779
  async create(params, options) {
1774
1780
  return this.client.request("POST", "/export", {
1775
1781
  body: params,
1776
- idempotencyKey: options?.idempotencyKey
1782
+ idempotencyKey: options?.idempotencyKey,
1783
+ responseType: params.format === "csv" ? "text" : "json"
1777
1784
  });
1778
1785
  }
1779
1786
  };
@@ -1938,7 +1945,7 @@ var BossResource = class {
1938
1945
  /** List boss defeat history. */
1939
1946
  async defeats(params) {
1940
1947
  return this.client.request("GET", "/game/boss/defeats", {
1941
- query: params
1948
+ query: params ? { ...params } : void 0
1942
1949
  });
1943
1950
  }
1944
1951
  /** Get a single defeat record. */
@@ -1953,25 +1960,25 @@ var AchievementsResource = class {
1953
1960
  /** List all achievements with progress. `params.userId` is required. */
1954
1961
  async list(params) {
1955
1962
  return this.client.request("GET", "/game/achievements", {
1956
- query: params
1963
+ query: params ? { ...params } : void 0
1957
1964
  });
1958
1965
  }
1959
1966
  /** List unlocked achievements only. */
1960
1967
  async unlocked(params) {
1961
1968
  return this.client.request("GET", "/game/achievements/unlocked", {
1962
- query: params
1969
+ query: params ? { ...params } : void 0
1963
1970
  });
1964
1971
  }
1965
1972
  /** Get a single achievement. */
1966
1973
  async get(achievementId, params) {
1967
1974
  return this.client.request("GET", `/game/achievements/${achievementId}`, {
1968
- query: params
1975
+ query: params ? { ...params } : void 0
1969
1976
  });
1970
1977
  }
1971
1978
  /** Get recently unlocked achievements across the team. */
1972
1979
  async recent(params) {
1973
1980
  return this.client.request("GET", "/game/achievements/recent", {
1974
- query: params
1981
+ query: params ? { ...params } : void 0
1975
1982
  });
1976
1983
  }
1977
1984
  };
@@ -1982,13 +1989,13 @@ var GameActivityResource = class {
1982
1989
  /** Get the team activity feed. */
1983
1990
  async list(params) {
1984
1991
  return this.client.request("GET", "/game/activity", {
1985
- query: params
1992
+ query: params ? { ...params } : void 0
1986
1993
  });
1987
1994
  }
1988
1995
  /** Get activity for a specific member. */
1989
1996
  async forMember(memberId, params) {
1990
1997
  return this.client.request("GET", `/game/activity/member/${memberId}`, {
1991
- query: params
1998
+ query: params ? { ...params } : void 0
1992
1999
  });
1993
2000
  }
1994
2001
  };
@@ -1999,13 +2006,13 @@ var QuestsResource = class {
1999
2006
  /** Get today's quests. */
2000
2007
  async today(params) {
2001
2008
  return this.client.request("GET", "/game/quests/today", {
2002
- query: params
2009
+ query: params ? { ...params } : void 0
2003
2010
  });
2004
2011
  }
2005
2012
  /** Get quest history. */
2006
2013
  async history(params) {
2007
2014
  return this.client.request("GET", "/game/quests/history", {
2008
- query: params
2015
+ query: params ? { ...params } : void 0
2009
2016
  });
2010
2017
  }
2011
2018
  };
@@ -2016,10 +2023,10 @@ var PuzzlesResource = class {
2016
2023
  /** Get today's puzzle. */
2017
2024
  async today(params) {
2018
2025
  return this.client.request("GET", "/game/puzzles/today", {
2019
- query: params
2026
+ query: params ? { ...params } : void 0
2020
2027
  });
2021
2028
  }
2022
- /** Submit a puzzle answer. */
2029
+ /** Record a completed puzzle, its timing and result. */
2023
2030
  async complete(params, options) {
2024
2031
  return this.client.request("POST", "/game/puzzles/complete", {
2025
2032
  body: params,
@@ -2029,13 +2036,13 @@ var PuzzlesResource = class {
2029
2036
  /** Get puzzle streak for a user. */
2030
2037
  async streak(params) {
2031
2038
  return this.client.request("GET", "/game/puzzles/streak", {
2032
- query: params
2039
+ query: params ? { ...params } : void 0
2033
2040
  });
2034
2041
  }
2035
2042
  /** Get puzzle leaderboard. */
2036
2043
  async leaderboard(params) {
2037
2044
  return this.client.request("GET", "/game/puzzles/leaderboard", {
2038
- query: params
2045
+ query: params ? { ...params } : void 0
2039
2046
  });
2040
2047
  }
2041
2048
  };
@@ -2046,7 +2053,7 @@ var OneUpsResource = class {
2046
2053
  /** List one-ups. */
2047
2054
  async list(params) {
2048
2055
  return this.client.request("GET", "/game/one-ups", {
2049
- query: params
2056
+ query: params ? { ...params } : void 0
2050
2057
  });
2051
2058
  }
2052
2059
  /** Send a one-up. */
@@ -2059,7 +2066,7 @@ var OneUpsResource = class {
2059
2066
  /** Check remaining free one-ups today. */
2060
2067
  async remaining(params) {
2061
2068
  return this.client.request("GET", "/game/one-ups/remaining", {
2062
- query: params
2069
+ query: params ? { ...params } : void 0
2063
2070
  });
2064
2071
  }
2065
2072
  };
@@ -2070,7 +2077,7 @@ var HighFivesResource = class {
2070
2077
  /** List high fives. */
2071
2078
  async list(params) {
2072
2079
  return this.client.request("GET", "/game/high-fives", {
2073
- query: params
2080
+ query: params ? { ...params } : void 0
2074
2081
  });
2075
2082
  }
2076
2083
  /** Send a high five. */
@@ -2083,7 +2090,7 @@ var HighFivesResource = class {
2083
2090
  /** Check if you can send a high five to a team. */
2084
2091
  async canSend(recipientTeamId, params) {
2085
2092
  return this.client.request("GET", `/game/high-fives/can-send/${recipientTeamId}`, {
2086
- query: params
2093
+ query: params ? { ...params } : void 0
2087
2094
  });
2088
2095
  }
2089
2096
  };
@@ -2094,13 +2101,13 @@ var CosmeticsResource = class {
2094
2101
  /** List unlocked cosmetics. */
2095
2102
  async list(params) {
2096
2103
  return this.client.request("GET", "/game/cosmetics", {
2097
- query: params
2104
+ query: params ? { ...params } : void 0
2098
2105
  });
2099
2106
  }
2100
2107
  /** Get cosmetic preferences. */
2101
2108
  async getPreferences(params) {
2102
2109
  return this.client.request("GET", "/game/cosmetics/preferences", {
2103
- query: params
2110
+ query: params ? { ...params } : void 0
2104
2111
  });
2105
2112
  }
2106
2113
  /** Update cosmetic preferences. */
@@ -2113,8 +2120,10 @@ var SeasonsResource = class {
2113
2120
  this.client = client;
2114
2121
  }
2115
2122
  /** List all seasons. */
2116
- async list() {
2117
- return this.client.request("GET", "/game/seasons");
2123
+ async list(params) {
2124
+ return this.client.request("GET", "/game/seasons", {
2125
+ query: params ? { ...params } : void 0
2126
+ });
2118
2127
  }
2119
2128
  /** Get the current active season. */
2120
2129
  async current() {
@@ -2123,7 +2132,7 @@ var SeasonsResource = class {
2123
2132
  /** Get user stats for a season. */
2124
2133
  async stats(seasonId, params) {
2125
2134
  return this.client.request("GET", `/game/seasons/${seasonId}/stats`, {
2126
- query: params
2135
+ query: params ? { ...params } : void 0
2127
2136
  });
2128
2137
  }
2129
2138
  };
@@ -2134,7 +2143,7 @@ var SkillsResource = class {
2134
2143
  /** Get the skill tree with current allocations. */
2135
2144
  async get(params) {
2136
2145
  return this.client.request("GET", "/game/skills", {
2137
- query: params
2146
+ query: params ? { ...params } : void 0
2138
2147
  });
2139
2148
  }
2140
2149
  /** Allocate a skill point. */
@@ -2169,7 +2178,7 @@ var GameResource = class {
2169
2178
  /** Get current player stats. */
2170
2179
  async player(params) {
2171
2180
  return this.client.request("GET", "/game/player", {
2172
- query: params
2181
+ query: params ? { ...params } : void 0
2173
2182
  });
2174
2183
  }
2175
2184
  /** Get a specific player's stats by membership ID. */
@@ -2184,13 +2193,13 @@ var GameResource = class {
2184
2193
  */
2185
2194
  async leaderboard(params) {
2186
2195
  return this.client.request("GET", "/game/leaderboard", {
2187
- query: params
2196
+ query: params ? { ...params } : void 0
2188
2197
  });
2189
2198
  }
2190
2199
  /** Get the current user's leaderboard position. */
2191
2200
  async myRank(params) {
2192
2201
  return this.client.request("GET", "/game/leaderboard/me", {
2193
- query: params
2202
+ query: params ? { ...params } : void 0
2194
2203
  });
2195
2204
  }
2196
2205
  /** Get game balance configuration (read-only constants). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cstar.help/js",
3
- "version": "0.17.2",
3
+ "version": "0.17.4",
4
4
  "description": "Official TypeScript SDK for the cStar customer support platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",