Skip to content

Commit 388da07

Browse files
authored
Merge pull request #487 from microsoftgraph/dev
Release 1.33.0
2 parents 2d64a63 + 4bf8a49 commit 388da07

27 files changed

Lines changed: 809 additions & 39 deletions

.github/workflows/create-beta-pull-request.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,30 @@ on:
1717
- 'src/Beta/**/*.php'
1818
- '!src/Core/GraphConstants.php'
1919

20+
defaults:
21+
run:
22+
shell: bash
23+
2024
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2125
jobs:
22-
# This workflow contains a single job called "create-pull-request"
23-
create-pull-request:
26+
bump-minor-version:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- name: Git config user
32+
run: |
33+
git config --global user.email "GraphTooling@service.microsoft.com"
34+
git config --global user.name "Microsoft Graph DevX Tooling"
35+
36+
- name: Run increment script
37+
run: php scripts/IncrementMinorVersion.php
2438

39+
- name: Commit and push changes if any
40+
run: if git commit -am "Bump up minor version"; then git push origin $GITHUB_REF; fi
41+
42+
create-pull-request:
43+
needs: bump-minor-version
2544
# The type of runner that the job will run on
2645
runs-on: ubuntu-latest
2746
# https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md
@@ -33,17 +52,15 @@ jobs:
3352

3453
# Create a pull request [1]
3554
- name: Create PR using the GitHub REST API via hub
36-
shell: bash
3755
env:
3856
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3957
MESSAGE_TITLE: Generated beta models using Typewriter
4058
MESSAGE_BODY: "This pull request was automatically created by the GitHub Action, **${{github.workflow}}**. \n\n The commit hash is _${{github.sha}}_. \n\n **Important** Check for unexpected deletions or changes in this PR. See [beta_metadata.xml](https://github.com/microsoftgraph/msgraph-metadata/blob/master/beta_metadata.xml) for metadata changes. \n\n Make sure the version number is incremented in /src/Core/GraphConstants.php. Compare the version against the latest release on [packagist.org](https://packagist.org/packages/microsoft/microsoft-graph) and update the version in src/Core/GraphConstants."
41-
ASSIGNEDTO: Ndiritu,silaskenneth
4259
LABELS: generated
4360
BASE: dev
4461
run: |
4562
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
46-
bin/hub pull-request -b "$BASE" -h "$GITHUB_REF" -m "$MESSAGE_TITLE" -m "$MESSAGE_BODY" -r "$REVIEWERS" -a "$ASSIGNEDTO" -l "$LABELS"
63+
bin/hub pull-request -b "$BASE" -h "$GITHUB_REF" -m "$MESSAGE_TITLE" -m "$MESSAGE_BODY" -r "$REVIEWERS" -l "$LABELS"
4764
# References
4865
# [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
4966
# [1] https://hub.github.com/hub-pull-request.1.html

.github/workflows/create-v1.0-pull-request.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,31 @@ on:
1919
- '!src/Core/GraphConstants.php'
2020
- '!src/Beta/**/*.php'
2121

22+
defaults:
23+
run:
24+
shell: bash
25+
2226
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2327
jobs:
24-
# This workflow contains a single job called "create-pull-request"
25-
create-pull-request:
28+
bump-minor-version:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v2
32+
33+
- name: Git config user
34+
run: |
35+
git config --global user.email "GraphTooling@service.microsoft.com"
36+
git config --global user.name "Microsoft Graph DevX Tooling"
37+
38+
- name: Run increment script
39+
run: php scripts/IncrementMinorVersion.php
40+
41+
- name: Commit and push changes if any
42+
run: if git commit -am "Bump up minor version"; then git push origin $GITHUB_REF; fi
2643

44+
create-pull-request:
45+
needs: bump-minor-version
46+
2747
# The type of runner that the job will run on
2848
runs-on: ubuntu-latest
2949
# https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md
@@ -35,17 +55,15 @@ jobs:
3555

3656
# Create a pull request [1]
3757
- name: Create PR using the GitHub REST API via hub
38-
shell: bash
3958
env:
4059
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4160
MESSAGE_TITLE: Generated models using Typewriter
4261
MESSAGE_BODY: "This pull request was automatically created by the GitHub Action, **${{github.workflow}}**. \n\n The commit hash is _${{github.sha}}_. \n\n **Important** Check for unexpected deletions or changes in this PR. See [v1.0_metadata.xml](https://github.com/microsoftgraph/msgraph-metadata/blob/master/v1.0_metadata.xml) for metadata changes. \n\n Make sure the version number is incremented in /src/Core/GraphConstants.php. Compare the version against the latest release on [packagist.org](https://packagist.org/packages/microsoft/microsoft-graph) and update the version in src/Core/GraphConstants."
43-
ASSIGNEDTO: Ndiritu,silaskenneth
4462
LABELS: generated
4563
BASE: dev
4664
run: |
4765
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
48-
bin/hub pull-request -b "$BASE" -h "$GITHUB_REF" -m "$MESSAGE_TITLE" -m "$MESSAGE_BODY" -r "$REVIEWERS" -a "$ASSIGNEDTO" -l "$LABELS"
66+
bin/hub pull-request -b "$BASE" -h "$GITHUB_REF" -m "$MESSAGE_TITLE" -m "$MESSAGE_BODY" -r "$REVIEWERS" -l "$LABELS"
4967
# References
5068
# [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
5169
# [1] https://hub.github.com/hub-pull-request.1.html

.github/workflows/pr-validation.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,21 @@ on:
1111
# Add assigned to defaults as a hack to easily trigger code-gen PRs to run validation
1212
types: [assigned, opened, synchronize, reopened]
1313

14+
defaults:
15+
run:
16+
shell: bash
17+
1418
jobs:
1519
validate-pull-request:
1620
runs-on: ubuntu-latest
1721
steps:
1822
- uses: actions/checkout@v2.3.4
1923
- name: composer validate
20-
shell: bash
2124
run: |
2225
composer validate
2326
- name: composer install
24-
shell: bash
2527
run: |
2628
composer install
2729
- name: run tests
28-
shell: bash
2930
run : |
3031
vendor/bin/phpunit --exclude-group functional

.github/workflows/tag-release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
# Adds a tag to main after a PR is merged succesfully.
5+
6+
name: "tag release"
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
13+
defaults:
14+
run:
15+
shell: bash
16+
17+
jobs:
18+
create-tag:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Get SDK version and set environment variable
24+
run: |
25+
SDK_VERSION=$(grep 'SDK_VERSION' src/Core/GraphConstants.php | grep -oE '[0-9]+\.[0-9]+\.([0-9]+|[0-9]+-[a-z]+)')
26+
echo "SDK_VERSION=$SDK_VERSION" >> $GITHUB_ENV
27+
28+
- name: Create and publish tag
29+
run: |
30+
echo "SDK_VERSION is:"$SDK_VERSION
31+
git tag $SDK_VERSION && git push origin $SDK_VERSION

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ You can install the PHP SDK with Composer, either run `composer require microsof
1111
```
1212
{
1313
"require": {
14-
"microsoft/microsoft-graph": "^1.20"
14+
"microsoft/microsoft-graph": "^1.33.0"
1515
}
1616
}
1717
```

scripts/IncrementMinorVersion.php

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?php
2+
/**
3+
* Copyright (c) Microsoft Corporation. All Rights Reserved.
4+
* Licensed under the MIT License. See License in the project root
5+
* for license information.
6+
*
7+
* Bumps up the minor version in src/Core/GraphConstants.php & README based on the latest published package version on Packagist
8+
*
9+
* Assumptions:
10+
* - Script is run from the repo root
11+
* - Script is run on a Unix environment (affects file path separator to files)
12+
* - Packagist returns tagged versions in descending order (latest release first)
13+
*/
14+
15+
const CONSTANTS_FILEPATH = "./src/Core/GraphConstants.php";
16+
const SDK_VERSION_VAR_NAME = "SDK_VERSION"; # Name of version variable in GraphConstants.php
17+
const PACKAGIST_ENDPOINT = "https://packagist.org/packages/microsoft/microsoft-graph.json";
18+
const CONSTANTS_README_FILEPATH = "./README.md";
19+
20+
function getLatestPackagistVersion(): string
21+
{
22+
$handle = curl_init();
23+
curl_setopt($handle, CURLOPT_URL, PACKAGIST_ENDPOINT);
24+
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
25+
curl_setopt($handle, CURLOPT_TIMEOUT, 100);
26+
curl_setopt($handle, CURLOPT_FAILONERROR, true);
27+
28+
echo "Fetching latest SDK version from " . PACKAGIST_ENDPOINT . "\n";
29+
$response = curl_exec($handle);
30+
31+
if (curl_error($handle)) {
32+
throw new Exception("Failed to get latest packagist version: ". curl_error($handle));
33+
}
34+
35+
curl_close($handle);
36+
37+
$responseJson = json_decode($response, true);
38+
if (!array_key_exists("package", $responseJson)
39+
|| !array_key_exists("versions", $responseJson["package"])
40+
|| empty($responseJson["package"]["versions"])) {
41+
42+
throw new Exception("Unable to find versions in the packagist response JSON: ". $responseJson);
43+
}
44+
45+
$versions = $responseJson["package"]["versions"];
46+
foreach ($versions as $version => $versionMetadata) {
47+
# Ignore branch versions
48+
if (!preg_match('/^dev-.*/', $version)) {
49+
# First non-branch version is the latest based on payload structure
50+
echo "Latest packagist version: {$version}\n";
51+
return $version;
52+
}
53+
}
54+
}
55+
56+
function incrementMinorVersion(string $version): string
57+
{
58+
$splitVersion = explode(".", $version);
59+
# Increment minor version
60+
$splitVersion[1] = strval(intval($splitVersion[1]) + 1);
61+
# Set patch to 0
62+
$splitVersion[2] = preg_replace('/[0-9]+/', "0", $splitVersion[2]);
63+
return implode(".", $splitVersion);
64+
}
65+
66+
function updateGraphConstants(string $version)
67+
{
68+
$fileContents = file_get_contents(CONSTANTS_FILEPATH);
69+
if ($fileContents) {
70+
$pattern = '/'. SDK_VERSION_VAR_NAME . '\s+=\s+".+"/';
71+
$replacement = SDK_VERSION_VAR_NAME . ' = "' . $version . '"';
72+
if (!file_put_contents(CONSTANTS_FILEPATH, preg_replace($pattern, $replacement, $fileContents))) {
73+
throw new Exception("Unable to find and replace SDK version variable ". SDK_VERSION_VAR_NAME);
74+
}
75+
echo "Successfully updated " . CONSTANTS_FILEPATH . "\n";
76+
return;
77+
}
78+
throw new Exception("Could not read GraphConstants.php at ". CONSTANTS_FILEPATH);
79+
}
80+
81+
function updateReadMe(string $version)
82+
{
83+
$fileContents = file_get_contents(CONSTANTS_README_FILEPATH);
84+
if ($fileContents) {
85+
$pattern = '/"microsoft\/microsoft-graph":\s+".+"/';
86+
$replacement = "\"microsoft/microsoft-graph\": \"^{$version}\"";
87+
if (!file_put_contents(CONSTANTS_README_FILEPATH, preg_replace($pattern, $replacement, $fileContents))) {
88+
throw new Exception("Unable to find and replace SDK version");
89+
}
90+
echo "Successfully updated README\n";
91+
return;
92+
}
93+
throw new Exception("Could not read README.md at " . CONSTANTS_README_FILEPATH);
94+
}
95+
96+
$version = incrementMinorVersion(getLatestPackagistVersion());
97+
echo "Version after minor increment: {$version}\n";
98+
updateGraphConstants($version);
99+
updateReadMe($version);

src/Beta/Microsoft/Graph/Model/AuthenticationContextClassReference.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class AuthenticationContextClassReference extends Entity
2626
{
2727
/**
2828
* Gets the description
29+
* A short explanation of the policies that are enforced by authenticationContextClassReference. This value should be used to provide secondary text to describe the authentication context class reference when building user facing admin experiences. For example, selection UX.
2930
*
3031
* @return string|null The description
3132
*/
@@ -40,6 +41,7 @@ public function getDescription()
4041

4142
/**
4243
* Sets the description
44+
* A short explanation of the policies that are enforced by authenticationContextClassReference. This value should be used to provide secondary text to describe the authentication context class reference when building user facing admin experiences. For example, selection UX.
4345
*
4446
* @param string $val The description
4547
*
@@ -53,6 +55,7 @@ public function setDescription($val)
5355

5456
/**
5557
* Gets the displayName
58+
* The display name is the friendly name of the authenticationContextClassReference. This value should be used to identify the authentication context class reference when building user facing admin experiences. For example, selection UX.
5659
*
5760
* @return string|null The displayName
5861
*/
@@ -67,6 +70,7 @@ public function getDisplayName()
6770

6871
/**
6972
* Sets the displayName
73+
* The display name is the friendly name of the authenticationContextClassReference. This value should be used to identify the authentication context class reference when building user facing admin experiences. For example, selection UX.
7074
*
7175
* @param string $val The displayName
7276
*
@@ -80,6 +84,7 @@ public function setDisplayName($val)
8084

8185
/**
8286
* Gets the isAvailable
87+
* Indicates whether the authenticationContextClassReference has been published by the security admin and is ready for use by apps. When it is set to false it should not be shown in admin UX experiences because the value is not currently available for selection.
8388
*
8489
* @return bool|null The isAvailable
8590
*/
@@ -94,6 +99,7 @@ public function getIsAvailable()
9499

95100
/**
96101
* Sets the isAvailable
102+
* Indicates whether the authenticationContextClassReference has been published by the security admin and is ready for use by apps. When it is set to false it should not be shown in admin UX experiences because the value is not currently available for selection.
97103
*
98104
* @param bool $val The isAvailable
99105
*

src/Beta/Microsoft/Graph/Model/Fido2AuthenticationMethod.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ public function setCreatedDateTime($val)
150150

151151
/**
152152
* Gets the creationDateTime
153-
* The timestamp when this key was registered to the user.
154153
*
155154
* @return \DateTime|null The creationDateTime
156155
*/
@@ -169,7 +168,6 @@ public function getCreationDateTime()
169168

170169
/**
171170
* Sets the creationDateTime
172-
* The timestamp when this key was registered to the user.
173171
*
174172
* @param \DateTime $val The creationDateTime
175173
*

src/Beta/Microsoft/Graph/Model/OAuth2PermissionGrant.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function setClientId($val)
5555

5656
/**
5757
* Gets the consentType
58-
* Indicates if authorization is granted for the client application to impersonate all users or only a specific user. AllPrincipals indicates authorization to impersonate all users. Principal indicates authorization to impersonate a specific user. Consent on behalf of all users can be granted by an administrator. Non-admin users may be authorized to consent on behalf of themselves in some cases, for some delegated permissions. Required. Supports $filter (eq only).
58+
* Indicates whether authorization is granted for the client application to impersonate all users or only a specific user. AllPrincipals indicates authorization to impersonate all users. Principal indicates authorization to impersonate a specific user. Consent on behalf of all users can be granted by an administrator. Non-admin users may be authorized to consent on behalf of themselves in some cases, for some delegated permissions. Required. Supports $filter (eq only).
5959
*
6060
* @return string|null The consentType
6161
*/
@@ -70,7 +70,7 @@ public function getConsentType()
7070

7171
/**
7272
* Sets the consentType
73-
* Indicates if authorization is granted for the client application to impersonate all users or only a specific user. AllPrincipals indicates authorization to impersonate all users. Principal indicates authorization to impersonate a specific user. Consent on behalf of all users can be granted by an administrator. Non-admin users may be authorized to consent on behalf of themselves in some cases, for some delegated permissions. Required. Supports $filter (eq only).
73+
* Indicates whether authorization is granted for the client application to impersonate all users or only a specific user. AllPrincipals indicates authorization to impersonate all users. Principal indicates authorization to impersonate a specific user. Consent on behalf of all users can be granted by an administrator. Non-admin users may be authorized to consent on behalf of themselves in some cases, for some delegated permissions. Required. Supports $filter (eq only).
7474
*
7575
* @param string $val The consentType
7676
*

src/Beta/Microsoft/Graph/Model/OrgContact.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,4 +558,32 @@ public function setTransitiveMemberOf($val)
558558
return $this;
559559
}
560560

561+
562+
/**
563+
* Gets the transitiveReports
564+
*
565+
* @return array|null The transitiveReports
566+
*/
567+
public function getTransitiveReports()
568+
{
569+
if (array_key_exists("transitiveReports", $this->_propDict)) {
570+
return $this->_propDict["transitiveReports"];
571+
} else {
572+
return null;
573+
}
574+
}
575+
576+
/**
577+
* Sets the transitiveReports
578+
*
579+
* @param DirectoryObject $val The transitiveReports
580+
*
581+
* @return OrgContact
582+
*/
583+
public function setTransitiveReports($val)
584+
{
585+
$this->_propDict["transitiveReports"] = $val;
586+
return $this;
587+
}
588+
561589
}

0 commit comments

Comments
 (0)