Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined types in Golang for users related to Delta parameters and configurations #768

Closed
Shaka-Man opened this issue Sep 1, 2024 · 2 comments
Assignees
Labels
Status no recent activity status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:bug A broken experience

Comments

@Shaka-Man
Copy link

Describe the bug

With an app-only authentication program I am attempting to monitor particular user's mail folder utilizing delta requests. The requests work in Graph Explorer. When utilizing the code snippet built by Explorer for the query an undefined returned for both the Parameters and the Configuration.

The two types in question are users.UserItemMailFolderItemMessagesDeltaWithRequestBuilderGetQueryParameters and users.UserItemMailFolderItemMessagesDeltaWithRequestBuilderGetRequestConfiguration.

Here is an example of the query used in Explorer:
https://graph.microsoft.com/v1.0/users/{id}/mailFolders('inbox')/messages/delta?changeType=created&$select=subject,from,isRead,body,receivedDateTime

The code snippet generated is as follows:

import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-sdk-go/users"
//other-imports
)

headers := abstractions.NewRequestHeaders()
headers.Add("Prefer", "outlook.body-content-type="text"")

requestChangeType := "created"

requestParameters := &graphusers.UserItemMailFolderItemMessagesDeltaWithRequestBuilderGetQueryParameters{
ChangeType: &requestChangeType,
Select: [] string {"subject","from","isRead","body","receivedDateTime"},
}
configuration := &graphusers.UserItemMailFolderItemMessagesDeltaWithRequestBuilderGetRequestConfiguration{
Headers: headers,
QueryParameters: requestParameters,
}

// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
delta, err := graphClient.Users().ByUserId("user-id").MailFolders().ByMailFolderId("mailFolder-id").Messages().Delta().GetAsDeltaGetResponse(context.Background(), configuration)

Expected behavior

I expected the sample code generated by Graph Explorer to compile

How to reproduce

Place the provided query in Explorer and execute. Review the Golang code snippet and open with vscode. That will immediately highlight the two types as undefined.

SDK Version

1.47.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

undefined: users.UserItemMailFolderItemMessagesDeltaWithRequestBuilderGetRequestConfigurationcompilerUndeclaredIm

(undefined: users.UserItemMailFolderItemMessagesDeltaWithRequestBuilderGetQueryParameterscompilerUndeclaredImporte

Configuration

macOS 14.6.1
Apple M3 Pro

Other information

No response

@Shaka-Man Shaka-Man added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Sep 1, 2024
@rkodev rkodev self-assigned this Oct 14, 2024
@rkodev
Copy link
Contributor

rkodev commented Oct 24, 2024

Hi @Shaka-Man , thank you for testing out the SDK.
I've noted the issue with the generated code and it will be fixed on the snippet generation tool

As for now, you can use the sample

	headers := abstractions.NewRequestHeaders()
	headers.Add("Prefer", "outlook.body-content-type=""text""")

	requestChangeType := "created"

	requestParameters := &graphusers.ItemMailFoldersItemMessagesDeltaRequestBuilderGetQueryParameters{
		ChangeType: &requestChangeType,
		Select:     []string{"subject", "from", "isRead", "body", "receivedDateTime"},
	}
	configuration := &graphusers.ItemMailFoldersItemMessagesDeltaRequestBuilderGetRequestConfiguration{
		Headers:         headers,
		QueryParameters: requestParameters,
	}

	// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
	delta, err := graphClient.Users().ByUserId("user-id").MailFolders().ByMailFolderId("mailFolder-id").Messages().Delta().GetAsDeltaGetResponse(context.Background(), configuration)

@rkodev rkodev added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Oct 24, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status no recent activity status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

2 participants