-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
144 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { APIRicevutaTelematica, Client } from ".."; | ||
import { Ricevuta, apiRequest } from ".."; | ||
|
||
/** | ||
* Ottieni i dati di una ricevuta telematica. | ||
* @param client - Il client | ||
* @param options - Altre opzioni della richiesta | ||
* @returns I dati | ||
*/ | ||
export const getRicevutaTelematica = async ( | ||
client: Client, | ||
options: { | ||
iuv: string; | ||
} | ||
) => { | ||
const { body } = await apiRequest<APIRicevutaTelematica>( | ||
"ricevutatelematica", | ||
client, | ||
{ | ||
method: "POST", | ||
body: { | ||
iuv: options.iuv, | ||
}, | ||
} | ||
); | ||
|
||
if (!body.success) throw new Error(body.msg); | ||
return new Ricevuta(body, client); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { APIRicevutaTelematica, Client, Jsonify } from ".."; | ||
import { Base } from ".."; | ||
|
||
type RicevutaData = APIRicevutaTelematica; | ||
type Data = Jsonify<Ricevuta> | RicevutaData; | ||
|
||
/** | ||
* Rappresenta i dati di una ricevuta | ||
*/ | ||
export class Ricevuta extends Base<RicevutaData> { | ||
nomeFile!: string; | ||
url!: string; | ||
|
||
/** | ||
* @param data - I dati ricevuti tramite l'API | ||
*/ | ||
constructor(data: Data, client: Client) { | ||
super(client); | ||
this.patch(data); | ||
} | ||
|
||
patch(data: Data) { | ||
if (this.isJson(data)) this.handleJson(data); | ||
else { | ||
this.nomeFile = data.fileName; | ||
this.url = data.url; | ||
} | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters