Skip to content

Commit a0a301c

Browse files
authored
Merge branch 'main' into CUST-4188
2 parents 5ee40e5 + 30a5b16 commit a0a301c

File tree

3 files changed

+124
-4
lines changed

3 files changed

+124
-4
lines changed

examples/src/main/java/com/nylas/examples/NotetakerExample.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,23 @@ private static void getNotetakerMedia(NylasClient nylas, String notetakerId) thr
217217
if (media.getData().getRecording() != null) {
218218
System.out.println("Recording:");
219219
System.out.println(" • URL: " + media.getData().getRecording().getUrl());
220-
System.out.println(" • Size: " + media.getData().getRecording().getSize() + " MB");
220+
System.out.println(" • Size: " + (media.getData().getRecording().getSize() / (1024.0 * 1024.0)) + " MB");
221+
System.out.println(" • Name: " + media.getData().getRecording().getName());
222+
System.out.println(" • Type: " + media.getData().getRecording().getType());
223+
System.out.println(" • Created At: " + media.getData().getRecording().getCreatedAt());
224+
System.out.println(" • Expires At: " + media.getData().getRecording().getExpiresAt());
225+
System.out.println(" • TTL: " + media.getData().getRecording().getTtl() + " seconds");
221226
}
222227

223228
if (media.getData().getTranscript() != null) {
224229
System.out.println("Transcript:");
225230
System.out.println(" • URL: " + media.getData().getTranscript().getUrl());
226-
System.out.println(" • Size: " + media.getData().getTranscript().getSize() + " MB");
231+
System.out.println(" • Size: " + (media.getData().getTranscript().getSize() / (1024.0 * 1024.0)) + " MB");
232+
System.out.println(" • Name: " + media.getData().getTranscript().getName());
233+
System.out.println(" • Type: " + media.getData().getTranscript().getType());
234+
System.out.println(" • Created At: " + media.getData().getTranscript().getCreatedAt());
235+
System.out.println(" • Expires At: " + media.getData().getTranscript().getExpiresAt());
236+
System.out.println(" • TTL: " + media.getData().getTranscript().getTtl() + " seconds");
227237
}
228238
}
229239

src/main/kotlin/com/nylas/models/Notetaker.kt

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,40 @@ data class NotetakerMediaResponse(
174174
val url: String,
175175

176176
/**
177-
* The size of the file, in MB
177+
* The size of the file, in bytes
178178
*/
179179
@Json(name = "size")
180180
val size: Int,
181+
182+
/**
183+
* The file name
184+
*/
185+
@Json(name = "name")
186+
val name: String,
187+
188+
/**
189+
* The file type/MIME type
190+
*/
191+
@Json(name = "type")
192+
val type: String,
193+
194+
/**
195+
* When the file was created (Unix timestamp)
196+
*/
197+
@Json(name = "created_at")
198+
val createdAt: Long,
199+
200+
/**
201+
* When the file will expire (Unix timestamp)
202+
*/
203+
@Json(name = "expires_at")
204+
val expiresAt: Long,
205+
206+
/**
207+
* Time-to-live in seconds until the file will be deleted off Nylas' storage server
208+
*/
209+
@Json(name = "ttl")
210+
val ttl: Int,
181211
)
182212

183213
/**
@@ -191,9 +221,39 @@ data class NotetakerMediaResponse(
191221
val url: String,
192222

193223
/**
194-
* The size of the file, in MB
224+
* The size of the file, in bytes
195225
*/
196226
@Json(name = "size")
197227
val size: Int,
228+
229+
/**
230+
* The file name
231+
*/
232+
@Json(name = "name")
233+
val name: String,
234+
235+
/**
236+
* The file type/MIME type
237+
*/
238+
@Json(name = "type")
239+
val type: String,
240+
241+
/**
242+
* When the file was created (Unix timestamp)
243+
*/
244+
@Json(name = "created_at")
245+
val createdAt: Long,
246+
247+
/**
248+
* When the file will expire (Unix timestamp)
249+
*/
250+
@Json(name = "expires_at")
251+
val expiresAt: Long,
252+
253+
/**
254+
* Time-to-live in seconds until the file will be deleted off Nylas' storage server
255+
*/
256+
@Json(name = "ttl")
257+
val ttl: Int,
198258
)
199259
}

src/test/kotlin/com/nylas/resources/NotetakersTests.kt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,56 @@ class NotetakersTests {
7474
assertEquals(true, notetaker.meetingSettings?.transcription)
7575
}
7676

77+
@Test
78+
fun `NotetakerMediaResponse serializes properly`() {
79+
val adapter = JsonHelper.moshi().adapter(NotetakerMediaResponse::class.java)
80+
val jsonBuffer = Buffer().writeUtf8(
81+
"""
82+
{
83+
"recording": {
84+
"size": 21550491,
85+
"name": "meeting_recording.mp4",
86+
"type": "video/mp4",
87+
"created_at": 1744222418,
88+
"expires_at": 1744481618,
89+
"url": "url_for_recording",
90+
"ttl": 259106
91+
},
92+
"transcript": {
93+
"size": 862,
94+
"name": "raw_transcript.json",
95+
"type": "application/json",
96+
"created_at": 1744222418,
97+
"expires_at": 1744481618,
98+
"url": "url_for_transcript",
99+
"ttl": 259106
100+
}
101+
}
102+
""".trimIndent(),
103+
)
104+
105+
val mediaResponse = adapter.fromJson(jsonBuffer)!!
106+
assertIs<NotetakerMediaResponse>(mediaResponse)
107+
108+
// Check recording
109+
assertEquals(21550491, mediaResponse.recording?.size)
110+
assertEquals("meeting_recording.mp4", mediaResponse.recording?.name)
111+
assertEquals("video/mp4", mediaResponse.recording?.type)
112+
assertEquals(1744222418, mediaResponse.recording?.createdAt)
113+
assertEquals(1744481618, mediaResponse.recording?.expiresAt)
114+
assertEquals("url_for_recording", mediaResponse.recording?.url)
115+
assertEquals(259106, mediaResponse.recording?.ttl)
116+
117+
// Check transcript
118+
assertEquals(862, mediaResponse.transcript?.size)
119+
assertEquals("raw_transcript.json", mediaResponse.transcript?.name)
120+
assertEquals("application/json", mediaResponse.transcript?.type)
121+
assertEquals(1744222418, mediaResponse.transcript?.createdAt)
122+
assertEquals(1744481618, mediaResponse.transcript?.expiresAt)
123+
assertEquals("url_for_transcript", mediaResponse.transcript?.url)
124+
assertEquals(259106, mediaResponse.transcript?.ttl)
125+
}
126+
77127
@Test
78128
fun `DeleteResponse serializes properly`() {
79129
val adapter = JsonHelper.moshi().adapter(DeleteResponse::class.java)

0 commit comments

Comments
 (0)