Suggestion: Generic OData response type
@nikithauc ci sta già lavorando.
Dal 5/4/2022.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
I think this library should include a type to match the OData response signature, as these properties are very important to consider in certain scenarios and I don't think the library consumer should have to define this type themselves or have to rely on another library.
Concretely, I suggest an implementation that ideally enables the following Angular code to compile
(this.http as HttpClient)
.get<ExampleODataType<User>>('https://graph.microsoft.com/v1.0/me')
.subscribe((response) => {
console.log(response['@odata.context']);
console.log(response.displayName);
});
(this.http as HttpClient)
.get<ExampleODataType<User[]>>('https://graph.microsoft.com/v1.0/users?$count')
.subscribe((response) => {
console.log(response['@odata.count']);
console.log(response['@odata.nextLink']);
console.log(response.value[0].displayName);
});
A simpler alternative to this could be a Type containing just the OData properties which one can make intersections with
(this.http as HttpClient)
.get<User & ExampleODataType>('https://graph.microsoft.com/v1.0/me')
.subscribe((response) => {
console.log(response['@odata.context']);
console.log(response.displayName);
});
(this.http as HttpClient)
.get<{ value: User[] } & ExampleODataType>('https://graph.microsoft.com/v1.0/users?$count')
.subscribe((response) => {
console.log(response['@odata.count']);
console.log(response['@odata.nextLink']);
console.log(response.value[0].displayName);
});
- Lingua principale
- PowerShell
- Stelle
- 129
- Fork
- 35
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoftgraph/msgraph-typescript-typings
-
status:waiting-for-triage type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
microsoftgraph/msgraph-typescript-typings#756 · 1 reazione ·
-
status:waiting-for-triage type:bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
microsoftgraph/msgraph-typescript-typings#748 · 2 reazioni ·
-
status:waiting-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
-
status:waiting-for-triage type:feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
microsoftgraph/msgraph-typescript-typings#530 · 1 reazione ·