From 75046043391b55afb4740ebd0e7eb177a4316d9f Mon Sep 17 00:00:00 2001 From: Girish Jeyakumar Date: Fri, 29 Mar 2019 13:10:01 -0700 Subject: [PATCH 1/4] Added sample Microsoft Graph - Office365Groups connector --- .../apiDefinition.swagger.json | 445 ++++++++++++++++++ samples/Office365Groups/apiProperties.json | 34 ++ 2 files changed, 479 insertions(+) create mode 100644 samples/Office365Groups/apiDefinition.swagger.json create mode 100644 samples/Office365Groups/apiProperties.json diff --git a/samples/Office365Groups/apiDefinition.swagger.json b/samples/Office365Groups/apiDefinition.swagger.json new file mode 100644 index 000000000..9b020431d --- /dev/null +++ b/samples/Office365Groups/apiDefinition.swagger.json @@ -0,0 +1,445 @@ +{ + "basePath": "/", + "host": "graph.microsoft.com", + "info": { + "description": "", + "title": "Office 365 Groups", + "version": "1.0.0" + }, + "consumes": [], + "definitions": { + "CreateGroupRequest": { + "properties": { + "displayName": { + "description": "O365 group name.", + "type": "string", + "x-ms-summary": "Name" + }, + "groupTypes": { + "description": "Leave blank for Security Group. Choose Unified for Office 365 and DynamicMembership for Dynamic group.", + "items": { + "default": "", + "enum": [ + "", + "Unified", + "DynamicMembership" + ], + "type": "string" + }, + "type": "array", + "x-ms-summary": "Group Type", + "x-ms-visibility": "advanced" + }, + "mailEnabled": { + "description": "True if mail is enabled for the group.", + "type": "boolean", + "x-ms-summary": "Mail Enabled" + }, + "mailNickname": { + "description": "Group nickname.", + "type": "string", + "x-ms-summary": "Nickname" + }, + "securityEnabled": { + "description": "True if the owner is security enabled.", + "type": "boolean", + "x-ms-summary": "Security Enabled" + } + }, + "required": [ + "displayName", + "mailEnabled", + "mailNickname", + "securityEnabled" + ], + "type": "object" + }, + "Group": { + "properties": { + "classification": { + "description": "O365 group classification.", + "type": "string", + "x-ms-summary": "Classification", + "x-ms-visibility": "advanced" + }, + "createdDateTime": { + "description": "yyyy-MM-ddTHH:mm:ss.fffZ (UTC format)", + "format": "date-time", + "type": "string", + "x-ms-summary": "Created Date-Time", + "x-ms-visibility": "advanced" + }, + "description": { + "description": "More information about the group.", + "type": "string", + "x-ms-summary": "Description" + }, + "displayName": { + "description": "O365 group name.", + "type": "string", + "x-ms-summary": "Name" + }, + "id": { + "description": "Unique identifier of the group.", + "type": "string", + "x-ms-summary": "Group Id", + "x-ms-visibility": "advanced" + }, + "mail": { + "description": "Email address of the group.", + "type": "string", + "x-ms-summary": "Email" + }, + "mailEnabled": { + "description": "True if mail is enabled for the group.", + "type": "boolean", + "x-ms-summary": "Mail Enabled", + "x-ms-visibility": "advanced" + }, + "mailNickname": { + "description": "Group nickname.", + "type": "string", + "x-ms-summary": "Nickname", + "x-ms-visibility": "advanced" + }, + "onPremisesLastSyncDateTime": { + "description": "yyyy-MM-ddTHH:mm:ss.fffZ (UTC format)", + "type": "string", + "x-ms-summary": "On-Premises Last Sync Date-Time", + "x-ms-visibility": "advanced" + }, + "onPremisesSecurityIdentifier": { + "description": "The on-premises security identifier.", + "type": "string", + "x-ms-summary": "On-Premises Security Identifier", + "x-ms-visibility": "advanced" + }, + "onPremisesSyncEnabled": { + "description": "True if on-premises sync is enabled for the group.", + "type": "string", + "x-ms-summary": "On-Premises Sync Enabled", + "x-ms-visibility": "advanced" + }, + "renewedDateTime": { + "description": "yyyy-MM-ddTHH:mm:ss.fffZ (UTC format)", + "format": "date-time", + "type": "string", + "x-ms-summary": "Renewed Date-Time", + "x-ms-visibility": "advanced" + }, + "securityEnabled": { + "description": "True if the owner is security enabled.", + "type": "boolean", + "x-ms-summary": "Security Enabled", + "x-ms-visibility": "advanced" + }, + "visibility": { + "description": "The owner's visibility.", + "type": "string", + "x-ms-summary": "Visibility", + "x-ms-visibility": "advanced" + } + }, + "type": "object" + }, + "ListGroupMembersResponse": { + "properties": { + "value": { + "description": "value", + "items": { + "properties": { + "displayName": { + "description": "User's display name.", + "type": "string", + "x-ms-summary": "Display Name" + }, + "givenName": { + "description": "User's first name.", + "type": "string", + "x-ms-summary": "Given Name" + }, + "id": { + "description": "Unique id of the user.", + "type": "string", + "x-ms-summary": "User Id", + "x-ms-visibility": "advanced" + }, + "jobTitle": { + "description": "User's job title.", + "type": "string", + "x-ms-summary": "Job Title" + }, + "mail": { + "description": "User's email address.", + "type": "string", + "x-ms-summary": "Mail" + }, + "mobilePhone": { + "description": "User's mobile number.", + "type": "string", + "x-ms-summary": "Mobile Phone", + "x-ms-visibility": "advanced" + }, + "officeLocation": { + "description": "User's office address.", + "type": "string", + "x-ms-summary": "Office Location", + "x-ms-visibility": "advanced" + }, + "surname": { + "description": "User's last name.", + "type": "string", + "x-ms-summary": "Surname" + }, + "userPrincipalName": { + "description": "UPN id of the user.", + "type": "string", + "x-ms-summary": "User Principal Name", + "x-ms-visibility": "advanced" + } + }, + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + }, + "ListGroupsResponse": { + "properties": { + "@odata.context": { + "description": "The OData context.", + "type": "string", + "x-ms-summary": "OData context", + "x-ms-visibility": "internal" + }, + "value": { + "description": "value", + "items": { + "$ref": "#/definitions/Group" + }, + "type": "array" + } + }, + "type": "object" + } + }, + "parameters": { + "groupId__in_path": { + "description": "Enter group id.", + "format": "guid", + "in": "path", + "name": "groupId", + "required": true, + "type": "string", + "x-ms-summary": "Group Id", + "x-ms-visibility": "important" + }, + "userId__in_path": { + "description": "Enter user id.", + "format": "guid", + "in": "path", + "name": "userId", + "required": true, + "type": "string", + "x-ms-summary": "User Id", + "x-ms-visibility": "important" + } + }, + "paths": { + "/v1.0/groups": { + "get": { + "description": "This operation returns a list all the groups available in an organization, including but not limited to Office 365 Groups.", + "operationId": "ListGroups", + "parameters": [], + "responses": { + "200": { + "description": "Operation Successful", + "schema": { + "$ref": "#/definitions/ListGroupsResponse" + } + } + }, + "summary": "List all groups", + "x-ms-visibility": "important" + }, + "post": { + "description": "This operation creates a new group.", + "operationId": "CreateGroup", + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateGroupRequest" + } + } + ], + "responses": { + "201": { + "description": "Operation Successful", + "schema": { + "$ref": "#/definitions/Group" + } + } + }, + "summary": "Create group", + "x-ms-visibility": "important" + } + }, + "/v1.0/groups/{groupId}": { + "delete": { + "description": "This operation deletes a group.", + "operationId": "DeleteGroup", + "parameters": [ + { + "$ref": "#/parameters/groupId__in_path" + } + ], + "responses": { + "204": { + "description": "Operation Successful", + "schema": { + "properties": {}, + "type": "object" + } + } + }, + "summary": "Delete group", + "x-ms-visibility": "important" + } + }, + "/v1.0/groups/{groupId}/members": { + "get": { + "description": "This operation returns a list of all members in the given group and their details such as name, title, email, etc.", + "operationId": "ListGroupMembers", + "parameters": [ + { + "$ref": "#/parameters/groupId__in_path" + } + ], + "responses": { + "200": { + "description": "Operation Successful", + "schema": { + "$ref": "#/definitions/ListGroupMembersResponse" + } + } + }, + "summary": "List group members", + "x-ms-pageable": { + "nextLinkName": "@odata.nextLink" + }, + "x-ms-visibility": "important" + } + }, + "/v1.0/groups/{groupId}/members/$ref": { + "post": { + "description": "This operation adds you as a member to a group", + "operationId": "JoinGroup", + "parameters": [ + { + "$ref": "#/parameters/groupId__in_path" + }, + { + "in": "body", + "name": "body", + "schema": { + "properties": { + "@odata.id": { + "default": "https://graph.microsoft.com/v1.0/me", + "description": "JSON representation of user object to be added.", + "type": "string", + "x-ms-summary": "User object", + "x-ms-visibility": "internal" + } + }, + "type": "object" + } + } + ], + "responses": { + "204": { + "description": "Operation Successful", + "schema": { + "properties": {}, + "type": "object" + } + } + }, + "summary": "Join group", + "x-ms-visibility": "important" + } + }, + "/v1.0/groups/{groupId}/members/{userId}/$ref": { + "delete": { + "description": "This operation removes a member from a group.", + "operationId": "RemoveMemberFromGroup", + "parameters": [ + { + "$ref": "#/parameters/groupId__in_path" + }, + { + "$ref": "#/parameters/userId__in_path" + } + ], + "responses": { + "204": { + "description": "Operation Successful", + "schema": { + "properties": {}, + "type": "object" + } + } + }, + "summary": "Remove member from group", + "x-ms-visibility": "important" + } + }, + "/v1.0/me/memberOf": { + "get": { + "description": "This operation returns a list of all groups that you are a member of.", + "operationId": "ListJoinedGroups", + "parameters": [], + "responses": { + "200": { + "description": "Operation Successful", + "schema": { + "$ref": "#/definitions/ListGroupsResponse" + } + } + }, + "summary": "List groups that I am a member of", + "x-ms-visibility": "important" + } + } + }, + "produces": [ + "application/json" + ], + "responses": {}, + "schemes": [ + "https" + ], + "security": [ + { + "oauth2_auth": [ + "Group.ReadWrite.All offline_access" + ] + } + ], + "securityDefinitions": { + "oauth2_auth": { + "authorizationUrl": "https://login.windows.net/common/oauth2/authorize", + "flow": "accessCode", + "scopes": { + "Group.ReadWrite.All offline_access": "Group.ReadWrite.All offline_access" + }, + "tokenUrl": "https://login.windows.net/common/oauth2/authorize", + "type": "oauth2" + } + }, + "swagger": "2.0", + "tags": [] +} \ No newline at end of file diff --git a/samples/Office365Groups/apiProperties.json b/samples/Office365Groups/apiProperties.json new file mode 100644 index 000000000..c82f978ad --- /dev/null +++ b/samples/Office365Groups/apiProperties.json @@ -0,0 +1,34 @@ +{ + "properties": { + "capabilities": [], + "connectionParameters": { + "token": { + "oAuthSettings": { + "clientId": "{AAD App ClientId}", + "customParameters": { + "loginUri": { + "value": "https://login.windows.net" + }, + "resourceUri": { + "value": "https://graph.microsoft.com" + }, + "tenantId": { + "value": "common" + } + }, + "identityProvider": "aad", + "properties": { + "IsFirstParty": "False" + }, + "redirectMode": "Global", + "redirectUrl": "https://global.consent.azure-apim.net/redirect", + "scopes": [ + "Group.ReadWrite.All offline_access" + ] + }, + "type": "oauthSetting" + } + }, + "iconBrandColor": "#007ee6" + } +} \ No newline at end of file From 956d418e4d37e914921df9288c0f2cc9b14a7cc5 Mon Sep 17 00:00:00 2001 From: Girish Jeyakumar Date: Fri, 29 Mar 2019 16:39:11 -0700 Subject: [PATCH 2/4] description update --- samples/Office365Groups/apiDefinition.swagger.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Office365Groups/apiDefinition.swagger.json b/samples/Office365Groups/apiDefinition.swagger.json index 9b020431d..50a40d6a1 100644 --- a/samples/Office365Groups/apiDefinition.swagger.json +++ b/samples/Office365Groups/apiDefinition.swagger.json @@ -2,7 +2,7 @@ "basePath": "/", "host": "graph.microsoft.com", "info": { - "description": "", + "description": "A sample Office 365 Groups connector for using with the CLI.", "title": "Office 365 Groups", "version": "1.0.0" }, From 0fb6e228b8a62cb893c64c998bbf1a48e17ed06e Mon Sep 17 00:00:00 2001 From: Girish Jeyakumar Date: Mon, 1 Apr 2019 16:03:47 -0700 Subject: [PATCH 3/4] updated swagger to address PR comments --- .../apiDefinition.swagger.json | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/samples/Office365Groups/apiDefinition.swagger.json b/samples/Office365Groups/apiDefinition.swagger.json index 50a40d6a1..cbbe3397d 100644 --- a/samples/Office365Groups/apiDefinition.swagger.json +++ b/samples/Office365Groups/apiDefinition.swagger.json @@ -16,11 +16,9 @@ "x-ms-summary": "Name" }, "groupTypes": { - "description": "Leave blank for Security Group. Choose Unified for Office 365 and DynamicMembership for Dynamic group.", + "description": "Choose Unified for Office 365 and DynamicMembership for Dynamic group. Leave blank for other types. ", "items": { - "default": "", "enum": [ - "", "Unified", "DynamicMembership" ], @@ -104,6 +102,7 @@ }, "onPremisesLastSyncDateTime": { "description": "yyyy-MM-ddTHH:mm:ss.fffZ (UTC format)", + "format": "date-time", "type": "string", "x-ms-summary": "On-Premises Last Sync Date-Time", "x-ms-visibility": "advanced" @@ -116,7 +115,7 @@ }, "onPremisesSyncEnabled": { "description": "True if on-premises sync is enabled for the group.", - "type": "string", + "type": "boolean", "x-ms-summary": "On-Premises Sync Enabled", "x-ms-visibility": "advanced" }, @@ -300,10 +299,7 @@ "responses": { "204": { "description": "Operation Successful", - "schema": { - "properties": {}, - "type": "object" - } + "schema": {} } }, "summary": "Delete group", @@ -355,6 +351,9 @@ "x-ms-visibility": "internal" } }, + "required": [ + "@odata.id" + ], "type": "object" } } @@ -362,10 +361,7 @@ "responses": { "204": { "description": "Operation Successful", - "schema": { - "properties": {}, - "type": "object" - } + "schema": {} } }, "summary": "Join group", @@ -387,10 +383,7 @@ "responses": { "204": { "description": "Operation Successful", - "schema": { - "properties": {}, - "type": "object" - } + "schema": {} } }, "summary": "Remove member from group", From c0f289d0a8a1b45854ef858daf2f66d9f0b74fdf Mon Sep 17 00:00:00 2001 From: Girish Jeyakumar Date: Mon, 1 Apr 2019 16:56:31 -0700 Subject: [PATCH 4/4] updated swagger to address PR comments --- samples/Office365Groups/apiDefinition.swagger.json | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/Office365Groups/apiDefinition.swagger.json b/samples/Office365Groups/apiDefinition.swagger.json index cbbe3397d..d52dc8669 100644 --- a/samples/Office365Groups/apiDefinition.swagger.json +++ b/samples/Office365Groups/apiDefinition.swagger.json @@ -341,6 +341,7 @@ { "in": "body", "name": "body", + "required": true, "schema": { "properties": { "@odata.id": {