Skip to content

Commit 8a03de7

Browse files
committed
feat(napi/types): support field "pre_retrieve_result"
1 parent a85c27a commit 8a03de7

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

napi/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export interface SongSearchInformation {
4444
identifier: string
4545
/** The details of this song. */
4646
song?: Song | undefined | null
47+
/** The pre-retrieve result of this search. */
48+
preRetrieveResult?: RetrievedSongInfo | undefined | null
4749
}
4850
/** [napi-rs] The information of the song retrieved with `retrieve()`. */
4951
export interface RetrievedSongInfo {

napi/src/types.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ pub struct SongSearchInformation {
4949
pub identifier: String,
5050
/// The details of this song.
5151
pub song: Option<Song>,
52+
/// The pre-retrieve result of this search.
53+
pub pre_retrieve_result: Option<RetrievedSongInfo>,
5254
}
5355

5456
/// [napi-rs] The information of the song retrieved with `retrieve()`.
@@ -135,6 +137,7 @@ impl From<unm_types::SongSearchInformation> for SongSearchInformation {
135137
source: song_information.source.to_string(),
136138
identifier: song_information.identifier,
137139
song: song_information.song.map(Into::into),
140+
pre_retrieve_result: song_information.pre_retrieve_result.map(Into::into),
138141
}
139142
}
140143
}
@@ -145,6 +148,7 @@ impl From<SongSearchInformation> for unm_types::SongSearchInformation {
145148
.source(song_information.source.into())
146149
.identifier(song_information.identifier)
147150
.song(song_information.song.map(Into::into))
151+
.pre_retrieve_result(song_information.pre_retrieve_result.map(Into::into))
148152
.build()
149153
}
150154
}
@@ -158,6 +162,15 @@ impl From<unm_types::RetrievedSongInfo> for RetrievedSongInfo {
158162
}
159163
}
160164

165+
impl From<RetrievedSongInfo> for unm_types::RetrievedSongInfo {
166+
fn from(song_information: RetrievedSongInfo) -> Self {
167+
Self::builder()
168+
.source(song_information.source.into())
169+
.url(song_information.url)
170+
.build()
171+
}
172+
}
173+
161174
impl From<Context> for unm_types::Context {
162175
fn from(context: Context) -> Self {
163176
let config = context

0 commit comments

Comments
 (0)