-
Notifications
You must be signed in to change notification settings - Fork 62
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
Support for generic directory objects and improved odata field handling #86
Conversation
- Adds a top level model struct for the directoryObject API base class - Embed this struct into other models to inherit the ID and odata fields - Support operations via the /directoryObjects endpoint - Improved handling of @odata.bind fields so that the tenant ID isn't needed to build odata URIs for objects
932ceaf
to
8c8ec5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few minor comments but this otherwise LGTM 👍
c := DirectoryObjectsClientTest{ | ||
connection: test.NewConnection(auth.MsGraph, auth.TokenVersion2), | ||
randomString: rs, | ||
} | ||
c.client = msgraph.NewDirectoryObjectsClient(c.connection.AuthConfig.TenantID) | ||
c.client.BaseClient.Authorizer = c.connection.Authorizer | ||
|
||
g := GroupsClientTest{ | ||
connection: test.NewConnection(auth.MsGraph, auth.TokenVersion2), | ||
randomString: rs, | ||
} | ||
g.client = msgraph.NewGroupsClient(c.connection.AuthConfig.TenantID) | ||
g.client.BaseClient.Authorizer = c.connection.Authorizer | ||
|
||
u := UsersClientTest{ | ||
connection: test.NewConnection(auth.MsGraph, auth.TokenVersion2), | ||
randomString: rs, | ||
} | ||
u.client = msgraph.NewUsersClient(c.connection.AuthConfig.TenantID) | ||
u.client.BaseClient.Authorizer = c.connection.Authorizer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be worth adding some test-wrappers here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
testDirectoryObjectsClient_Get(t, c, *user.ID) | ||
testDirectoryObjectsClient_Get(t, c, *group1.ID) | ||
testDirectoryObjectsClient_GetMemberGroups(t, c, *user.ID, true, []string{*group1.ID, *group2.ID}) | ||
testDirectoryObjectsClient_GetMemberObjects(t, c, *group1.ID, true, []string{*group2.ID}) | ||
testDirectoryObjectsClient_GetByIds(t, c, []string{*group1.ID, *group2.ID, *user.ID}, []string{odata.ShortTypeGroup}) | ||
testDirectoryObjectsClient_Delete(t, c, *group1.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using something like Testify's suite
package would make this easier fwiw (since these'd be methods hanging off of that struct with a Setup, as your doing here?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, will take a look at that and improving the test setup sprawl 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aside from a couple mindor comments LGTM 👍
c := DirectoryObjectsClientTest{ | ||
connection: test.NewConnection(auth.MsGraph, auth.TokenVersion2), | ||
randomString: rs, | ||
} | ||
c.client = msgraph.NewDirectoryObjectsClient(c.connection.AuthConfig.TenantID) | ||
c.client.BaseClient.Authorizer = c.connection.Authorizer | ||
|
||
g := GroupsClientTest{ | ||
connection: test.NewConnection(auth.MsGraph, auth.TokenVersion2), | ||
randomString: rs, | ||
} | ||
g.client = msgraph.NewGroupsClient(c.connection.AuthConfig.TenantID) | ||
g.client.BaseClient.Authorizer = c.connection.Authorizer | ||
|
||
u := UsersClientTest{ | ||
connection: test.NewConnection(auth.MsGraph, auth.TokenVersion2), | ||
randomString: rs, | ||
} | ||
u.client = msgraph.NewUsersClient(c.connection.AuthConfig.TenantID) | ||
u.client.BaseClient.Authorizer = c.connection.Authorizer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Amongst other benefits, this should enable us to determine the type of an object given its UUID.