Git Product home page Git Product logo

microsoft-graph-devx-api's People

Contributors

andrueastman avatar baywet avatar calebkiage avatar d-titusgicheru avatar danielmbaluka avatar darrelmiller avatar ddyett avatar dependabot[bot] avatar fey101 avatar georgend avatar irvinesunday avatar jasonjoh avatar maggiekimani1 avatar maryanngitonga avatar michaelmainer avatar millicentachieng avatar ndiritu avatar onokaev avatar peombwa avatar ramsessanchez avatar rkodev avatar samwelkanda avatar shemogumbe avatar shjokie avatar silaskenneth avatar thewahome avatar timayabi2020 avatar zengin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microsoft-graph-devx-api's Issues

Permissions API

Currently, one needs to manually assign themselves permissions to run specific queries.
With this API GE will be able to detect the query parameters and suggest the permissions that the user needs to request. This makes the experience way easier for the developers. Microsoft workloads can call secured API to add new permissions

Autocomplete API

This is an intelligent API that can detect the query that the user is typing and give appropriate suggestions. Depending on the query type the API will give the appropriate request types as options. One doesn't have to remember the query parameters since the APi will have a Query Builder from where a user can pick the parameters, they wish to add to their query parameter.

Provide checks to use pluralized variables names when accessing collections

Looking at this sample

GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var user = await graphClient.Users
    .Request()
    .Select( e => new {
             e.DisplayName,
             e.GivenName,
             e.PostalCode 
             })
    .GetAsync();

The variable name used is in singular but we are actually returning a collection of users.

We can use this library https://www.nuget.org/packages/Pluralize.NET.Core/ to pluralize variable names when we need to.

Accept MailTipsType enum as second parameter to GetMailTips for C#

GetMailTips snippet should accept MailTipsType enum and not a string for C#.

Expected snippet should look like this:

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var emailAddressesList = new List<String>();
emailAddressesList .Add( "[email protected]" );
emailAddressesList .Add( "[email protected]" );

// Use MailTipsType enum.
var mailTipsOptions = MailTipsType.AutomaticReplies | MailTipsType.MailboxFullStatus;

await graphClient.Me
	.GetMailTips(emailAddressesList, mailTipsOptions)
	.Request()
	.PostAsync()

Make C# object construction more concise with object initializers

Currently we generate objects using an intermediate variable,

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var emailAddress = new EmailAddress
{
	Address = "[email protected]",
	Name = "Samantha Booth",
};

var attendees = new Attendee
{
	EmailAddress = emailAddress,
	Type = AttendeeType.Required,
};

var attendeesList = new List<Attendee>();
attendeesList.Add( attendees );

var location = new Location
{
	DisplayName = "Harry's Bar",
};

var end = new DateTimeTimeZone
{
	DateTime = "2017-04-15T14:00:00",
	TimeZone = "Pacific Standard Time",
};

var start = new DateTimeTimeZone
{
	DateTime = "2017-04-15T12:00:00",
	TimeZone = "Pacific Standard Time",
};

var body = new ItemBody
{
	ContentType = BodyType.Html,
	Content = "Does late morning work for you?",
};

var event = new Event
{
	Subject = "Let's go for lunch",
	Body = body,
	Start = start,
	End = end,
	Location = location,
	Attendees = attendeesList,
};

await graphClient.Me.Events
	.Request()
	.AddAsync(event);

however there is a more concise syntax that looks like this,

            var event1 = new Event
            {
                Subject = "Let's go for lunch",
                Body = new ItemBody
                {
                    ContentType = BodyType.Html,
                    Content = "Does late morning work for you?",
                },
                Start = new DateTimeTimeZone
                {
                    DateTime = "2019-04-23T12:00:00",
                    TimeZone = "Pacific Standard Time",
                },
                End = new DateTimeTimeZone
                {
                    DateTime = "2019-04-23T14:00:00",
                    TimeZone = "Pacific Standard Time",
                },
                Location = new Location
                {
                    DisplayName = "Harry's Bar",
                },
                Attendees = new List<Attendee>() {
                    new Attendee
                    {
                        EmailAddress = new EmailAddress
                        {
                            Address = "[email protected]",
                            Name = "Samantha Booth",
                        },
                        Type = AttendeeType.Required,
                    },
                }
            };

We should evaluate how much work it might take to generate this.

Provide checks for reserved words in variable names

The following snippet generated contains the reserved word "event" as a variable name in C#.

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var emailAddress = new EmailAddress
{
	Address = "[email protected]",
	Name = "Samantha Booth",
};

var attendees = new Attendee
{
	EmailAddress = emailAddress,
	Type = AttendeeType.Required,
};

var attendeesList = new List<Attendee>();
attendeesList.Add( attendees );

var location = new Location
{
	DisplayName = "Harry's Bar",
};

var end = new DateTimeTimeZone
{
	DateTime = "2017-04-15T14:00:00",
	TimeZone = "Pacific Standard Time",
};

var start = new DateTimeTimeZone
{
	DateTime = "2017-04-15T12:00:00",
	TimeZone = "Pacific Standard Time",
};

var body = new ItemBody
{
	ContentType = BodyType.Html,
	Content = "Does late morning work for you?",
};

var event = new Event
{
	Subject = "Let's go for lunch",
	Body = body,
	Start = start,
	End = end,
	Location = location,
	Attendees = attendeesList,
};

await graphClient.Me.Events
	.Request()
	.AddAsync(event);

Ideally variable names should not be reserved words for the language in use.

Get the actual return type

Providing the actual return type versus implicitly typing the variable would provide more value.

There are business rules for determining the return type. For example, for collections, it is I*CollectionPage, where * is the return type in the collection with an optional name of the OData action. IMailFolderDeltaCollectionPage is an example of this.

Originally posted by @andrueastman in #41 (comment)
AB#7030

Update select expressions to use anonymous objects rather that comma separated strings

Rather than use comma delimited list as the parameter for select expressions like in the example below

var event = await graphClient.Me.Events
	.Request()
	.Header("Prefer","outlook.timezone=\"Pacific Standard Time\"")
	.Select("subject,body,bodyPreview,organizer,attendees,start,end,location")
	.GetAsync();

Use an anonymous object for select expression like this:-

var event = await graphClient.Me.Events.Request()
       .Header("Prefer","outlook.timezone=\"Pacific Standard Time\"")
       .Select(e => new { e.Subject,
                          e.Body,
                          e.bodyPreview,
                          e.organizer,
                          e.attendees,
                          e.start,
                          e.end,
                          e.location 
                         })
       .GetAsync();

This provides a strongly typed experience and would be good for the snippets to show this as a best practice.

Incorrect C# constructor generation

Looking at the sample below,

  • Recipient does not have a constructor that accepts email address. The property needs to be set explicitly
  • ContentType is an enum not a string.
GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var value = "NV001";

var name = "x-custom-header-group-id";

var valueVar = "Nevada";

var nameVar = "x-custom-header-group-nameVar";

//create InternetMessageHeader list and populate it
var internetMessageHeaders = new List<InternetMessageHeader>();
internetMessageHeaders.Add(new InternetMessageHeader(nameVar,valueVar));
internetMessageHeaders.Add(new InternetMessageHeader(name,value));

//create instance of EmailAddress
var emailAddress = new EmailAddress
{
	Address = "[email protected]",
};

//create Recipient list and populate it
var toRecipients = new List<Recipient>();
toRecipients.Add(new Recipient(emailAddress));

//create instance of ItemBody
var body = new ItemBody
{
	ContentType = "HTML",
	Content = "The group represents Nevada.",
};

//create instance of Message
var message = new Message
{
	Subject = "9/9/2018: concert",
	Body = body,
	ToRecipients = toRecipients,
	InternetMessageHeaders = internetMessageHeaders,
};

await graphClient.Me
	.SendMail(message,saveToSentItems)
	.Request()
	.PostAsync()

C# Enums not looked up in object construction

Looking at the sample below,

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var value = "NV001";

var name = "x-custom-header-group-id";

var valueVar = "Nevada";

var nameVar = "x-custom-header-group-nameVar";

//create InternetMessageHeader list and populate it
var internetMessageHeaders = new List<InternetMessageHeader>();
internetMessageHeaders.Add(new InternetMessageHeader(nameVar,valueVar));
internetMessageHeaders.Add(new InternetMessageHeader(name,value));

//create instance of EmailAddress
var emailAddress = new EmailAddress
{
	Address = "[email protected]",
};

//create Recipient list and populate it
var toRecipients = new List<Recipient>();
toRecipients.Add(new Recipient(emailAddress));

//create instance of ItemBody
var body = new ItemBody
{
	ContentType = "HTML",
	Content = "The group represents Nevada.",
};

//create instance of Message
var message = new Message
{
	Subject = "9/9/2018: concert",
	Body = body,
	ToRecipients = toRecipients,
	InternetMessageHeaders = internetMessageHeaders,
};

await graphClient.Me
	.SendMail(message,saveToSentItems)
	.Request()
	.PostAsync()

The ContentType member in ItemBody should be an enum and not a string. Snippet generation should look up enum types as well.

Changes API

This API will detect changes in Graph API and notify users in Graph Explorer with a blue star on the samples with changes.
Requires intelligent mapping on the url to detect the query that the user types and checks if it has changed in the recent past.

Snippet Generation for Structural properties in C#

The support on the Graph SDK for accessing structural properties needs to catered for and therefore using a direct url isn't correct.

More info can be found on the issue raised here

Snippet generation on the C# needs to be refactored to cater for this.

Samples API

Adding a new sample to Graph Explorer at the moment is very complicated and a manual process.
This API will automate the process allowing one to just add a HTTP request when adding a new sample and the API takes care of the rest of the process. At the moment, with every sample added, a deployment must be done, with this API there will be no need for deployment to create a new sample. Requires securing for the API to create new samples. Reading samples can be done anonymously

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.