@@ -75,7 +75,7 @@ interface RaccomandataResponse {
7575 mittente ?: Mittente ;
7676 destinatari ?: Destinatario [ ] ;
7777 documento ?: string [ ] ;
78- opzioni ?: Opzioni ;
78+ opzioni ?: OpzioniRaccomandata ;
7979 prodotto ?: string ;
8080 creation_timestamp ?: number ;
8181 update_timestamp ?: number ;
@@ -135,15 +135,15 @@ export class UfficioPostale implements Service {
135135 }
136136
137137 async listDug ( ) : Promise < { codice_dug : string ; dug : string } [ ] > {
138- return await ( await this . client . get ( this . url + '/dug' ) ) . data . data ;
138+ return await ( await this . client . get ( this . url + '/dug/ ' ) ) . data . data ;
139139 }
140140
141141 async addresses ( cap : string , comune : string , dug : string ) {
142142 return await ( await this . client . get ( this . url + '/indirizzi' , { params : { cap, comune, dug} } ) ) . data . data ;
143143 }
144144
145- async pricing ( cap : string , comune : string , dug : string ) : Promise < Array < any > > {
146- return await ( await this . client . get ( this . url + '/pricing' ) ) . data . data ;
145+ async pricing ( ) : Promise < Array < any > > {
146+ return await ( await this . client . get ( this . url + '/pricing/ ' ) ) . data . data ;
147147 }
148148
149149 async track ( id : string ) : Promise < TrackingStatus [ ] > {
@@ -163,8 +163,9 @@ export class UfficioPostale implements Service {
163163 return await ( await this . client . get ( this . url + '/raccomandate/' + id ) ) . data . data ;
164164 }
165165
166- async createRaccomandata ( mittente : Mittente , destinatari : Destinatario [ ] , documento : string [ ] , autoconfirm = true , options : OpzioniRaccomandata = { } ) {
167- return await ( await this . client . post ( this . url + '/raccomandate/' , JSON . stringify ( { mittente, destinatari, documento, options : { autoconfirm, ...options } } ) ) ) . data . data ;
166+ async createRaccomandata ( mittente : Mittente , destinatari : Destinatario [ ] , documento : string [ ] , autoconfirm = true , options : OpzioniRaccomandata = { } ) : Promise < any [ ] > {
167+ if ( ! Array . isArray ( destinatari ) ) destinatari = [ destinatari ] ;
168+ return await ( await this . client . post ( this . url + '/raccomandate/' , JSON . stringify ( { mittente, destinatari, documento, opzioni : { autoconfirm, ...options } } ) ) ) . data . data ;
168169 }
169170
170171 async confirmRaccomandata ( id : string ) {
@@ -180,8 +181,9 @@ export class UfficioPostale implements Service {
180181 return await ( await this . client . get ( this . url + '/telegrammi/' + id ) ) . data . data ;
181182 }
182183
183- async createTelegramma ( mittente : Mittente , destinatari : Destinatario [ ] , documento : string , autoconfirm = true , options : OpzioniTelegramma = { } ) {
184- return await ( await this . client . post ( this . url + '/telegrammi/' , JSON . stringify ( { mittente, destinatari, documento, options : { autoconfirm, ...options } } ) ) ) . data . data ;
184+ async createTelegramma ( mittente : Mittente , destinatari : Destinatario [ ] , documento : string , autoconfirm = true , options : OpzioniTelegramma = { } ) : Promise < any [ ] > {
185+ if ( ! Array . isArray ( destinatari ) ) destinatari = [ destinatari ] ;
186+ return await ( await this . client . post ( this . url + '/telegrammi/' , JSON . stringify ( { mittente, destinatari, documento, opzioni : { autoconfirm, ...options } } ) ) ) . data . data ;
185187 }
186188
187189 async confirmTelegramma ( id : string ) {
0 commit comments