@@ -173,6 +173,97 @@ func TestProjectKeysService_List(t *testing.T) {
173
173
assert .Equal (t , expected , projectKeys )
174
174
}
175
175
176
+ func TestProjectKeysService_Get (t * testing.T ) {
177
+ client , mux , _ , teardown := setup ()
178
+ defer teardown ()
179
+
180
+ mux .HandleFunc ("/api/0/projects/the-interstellar-jurisdiction/pump-station/keys/60120449b6b1d5e45f75561e6dabd80b/" , func (w http.ResponseWriter , r * http.Request ) {
181
+ assertMethod (t , "GET" , r )
182
+ w .Header ().Set ("Content-Type" , "application/json" )
183
+ fmt .Fprint (w , `{
184
+ "id": "60120449b6b1d5e45f75561e6dabd80b",
185
+ "name": "Liked Pegasus",
186
+ "label": "Liked Pegasus",
187
+ "public": "60120449b6b1d5e45f75561e6dabd80b",
188
+ "secret": "189485c3b8ccf582bf5e12c530ef8858",
189
+ "projectId": 4505281256090153,
190
+ "isActive": true,
191
+ "rateLimit": {
192
+ "window": 7200,
193
+ "count": 1000
194
+ },
195
+ "dsn": {
196
+ "secret": "https://a785682ddda742d7a8a4088810e67701:bcd99b3790b3441c85ce4b1eaa854f66@o4504765715316736.ingest.sentry.io/4505281256090153",
197
+ "public": "https://a785682ddda742d7a8a4088810e67791@o4504765715316736.ingest.sentry.io/4505281256090153",
198
+ "csp": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/csp-report/?sentry_key=a785682ddda719b7a8a4011110d75598",
199
+ "security": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/security/?sentry_key=a785682ddda719b7a8a4011110d75598",
200
+ "minidump": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/minidump/?sentry_key=a785682ddda719b7a8a4011110d75598",
201
+ "nel": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/nel/?sentry_key=a785682ddda719b7a8a4011110d75598",
202
+ "unreal": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/unreal/a785682ddda719b7a8a4011110d75598/",
203
+ "cdn": "https://js.sentry-cdn.com/a785682ddda719b7a8a4011110d75598.min.js",
204
+ "crons": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/crons/___MONITOR_SLUG___/a785682ddda719b7a8a4011110d75598/"
205
+ },
206
+ "browserSdkVersion": "7.x",
207
+ "browserSdk": {
208
+ "choices": [
209
+ [
210
+ "latest",
211
+ "latest"
212
+ ],
213
+ [
214
+ "7.x",
215
+ "7.x"
216
+ ]
217
+ ]
218
+ },
219
+ "dateCreated": "2023-06-21T19:50:26.036254Z",
220
+ "dynamicSdkLoaderOptions": {
221
+ "hasReplay": true,
222
+ "hasPerformance": true,
223
+ "hasDebug": true
224
+ }
225
+ }` )
226
+ })
227
+
228
+ ctx := context .Background ()
229
+ projectKey , _ , err := client .ProjectKeys .Get (ctx , "the-interstellar-jurisdiction" , "pump-station" , "60120449b6b1d5e45f75561e6dabd80b" )
230
+ assert .NoError (t , err )
231
+
232
+ expected := & ProjectKey {
233
+ ID : "60120449b6b1d5e45f75561e6dabd80b" ,
234
+ Name : "Liked Pegasus" ,
235
+ Label : "Liked Pegasus" ,
236
+ Public : "60120449b6b1d5e45f75561e6dabd80b" ,
237
+ Secret : "189485c3b8ccf582bf5e12c530ef8858" ,
238
+ ProjectID : json .Number ("4505281256090153" ),
239
+ IsActive : true ,
240
+ RateLimit : & ProjectKeyRateLimit {
241
+ Window : 7200 ,
242
+ Count : 1000 ,
243
+ },
244
+ DSN : ProjectKeyDSN {
245
+ Secret : "https://a785682ddda742d7a8a4088810e67701:bcd99b3790b3441c85ce4b1eaa854f66@o4504765715316736.ingest.sentry.io/4505281256090153" ,
246
+ Public : "https://a785682ddda742d7a8a4088810e67791@o4504765715316736.ingest.sentry.io/4505281256090153" ,
247
+ CSP : "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/csp-report/?sentry_key=a785682ddda719b7a8a4011110d75598" ,
248
+ Security : "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/security/?sentry_key=a785682ddda719b7a8a4011110d75598" ,
249
+ Minidump : "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/minidump/?sentry_key=a785682ddda719b7a8a4011110d75598" ,
250
+ NEL : "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/nel/?sentry_key=a785682ddda719b7a8a4011110d75598" ,
251
+ Unreal : "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/unreal/a785682ddda719b7a8a4011110d75598/" ,
252
+ CDN : "https://js.sentry-cdn.com/a785682ddda719b7a8a4011110d75598.min.js" ,
253
+ Crons : "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/crons/___MONITOR_SLUG___/a785682ddda719b7a8a4011110d75598/" ,
254
+ },
255
+ BrowserSDKVersion : "7.x" ,
256
+ DateCreated : mustParseTime ("2023-06-21T19:50:26.036254Z" ),
257
+ DynamicSDKLoaderOptions : ProjectKeyDynamicSDKLoaderOptions {
258
+ HasReplay : true ,
259
+ HasPerformance : true ,
260
+ HasDebugFiles : true ,
261
+ },
262
+ }
263
+
264
+ assert .Equal (t , expected , projectKey )
265
+ }
266
+
176
267
func TestProjectKeysService_Create (t * testing.T ) {
177
268
client , mux , _ , teardown := setup ()
178
269
defer teardown ()
0 commit comments