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

Generated models and request builders #1338

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ You can install the PHP SDK with Composer by editing your `composer.json` file:
{
"minimum-stability": "RC",
"require": {
"microsoft/microsoft-graph": "^2.0.0-RC23",
"microsoft/microsoft-graph": "^2.0.0-RC24",
}
}
```
OR
```
{
"require": {
"microsoft/microsoft-graph": "^2.0.0-RC23",
"microsoft/microsoft-graph": "^2.0.0-RC24",
"microsoft/microsoft-graph-core": "@RC"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Microsoft\Graph\Generated\Communications\Presences\Item\ClearPresence\ClearPresenceRequestBuilder;
use Microsoft\Graph\Generated\Communications\Presences\Item\ClearUserPreferredPresence\ClearUserPreferredPresenceRequestBuilder;
use Microsoft\Graph\Generated\Communications\Presences\Item\SetPresence\SetPresenceRequestBuilder;
use Microsoft\Graph\Generated\Communications\Presences\Item\SetStatusMessage\SetStatusMessageRequestBuilder;
use Microsoft\Graph\Generated\Communications\Presences\Item\SetUserPreferredPresence\SetUserPreferredPresenceRequestBuilder;
use Microsoft\Graph\Generated\Models\ODataErrors\ODataError;
use Microsoft\Graph\Generated\Models\Presence;
Expand Down Expand Up @@ -42,6 +43,13 @@ public function setPresence(): SetPresenceRequestBuilder {
return new SetPresenceRequestBuilder($this->pathParameters, $this->requestAdapter);
}

/**
* Provides operations to call the setStatusMessage method.
*/
public function setStatusMessage(): SetStatusMessageRequestBuilder {
return new SetStatusMessageRequestBuilder($this->pathParameters, $this->requestAdapter);
}

/**
* Provides operations to call the setUserPreferredPresence method.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php

namespace Microsoft\Graph\Generated\Communications\Presences\Item\SetStatusMessage;

use Microsoft\Graph\Generated\Models\PresenceStatusMessage;
use Microsoft\Kiota\Abstractions\Serialization\AdditionalDataHolder;
use Microsoft\Kiota\Abstractions\Serialization\Parsable;
use Microsoft\Kiota\Abstractions\Serialization\ParseNode;
use Microsoft\Kiota\Abstractions\Serialization\SerializationWriter;
use Microsoft\Kiota\Abstractions\Store\BackedModel;
use Microsoft\Kiota\Abstractions\Store\BackingStore;
use Microsoft\Kiota\Abstractions\Store\BackingStoreFactorySingleton;

class SetStatusMessagePostRequestBody implements AdditionalDataHolder, BackedModel, Parsable
{
/**
* @var BackingStore $backingStore Stores model information.
*/
private BackingStore $backingStore;

/**
* Instantiates a new setStatusMessagePostRequestBody and sets the default values.
*/
public function __construct() {
$this->backingStore = BackingStoreFactorySingleton::getInstance()->createBackingStore();
$this->setAdditionalData([]);
}

/**
* Creates a new instance of the appropriate class based on discriminator value
* @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object
* @return SetStatusMessagePostRequestBody
*/
public static function createFromDiscriminatorValue(ParseNode $parseNode): SetStatusMessagePostRequestBody {
return new SetStatusMessagePostRequestBody();
}

/**
* Gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
* @return array<string, mixed>|null
*/
public function getAdditionalData(): ?array {
$val = $this->getBackingStore()->get('additionalData');
if (is_null($val) || is_array($val)) {
/** @var array<string, mixed>|null $val */
return $val;
}
throw new \UnexpectedValueException("Invalid type found in backing store for 'additionalData'");
}

/**
* Gets the backingStore property value. Stores model information.
* @return BackingStore
*/
public function getBackingStore(): BackingStore {
return $this->backingStore;
}

/**
* The deserialization information for the current model
* @return array<string, callable(ParseNode): void>
*/
public function getFieldDeserializers(): array {
$o = $this;
return [
'statusMessage' => fn(ParseNode $n) => $o->setStatusMessage($n->getObjectValue([PresenceStatusMessage::class, 'createFromDiscriminatorValue'])),
];
}

/**
* Gets the statusMessage property value. The statusMessage property
* @return PresenceStatusMessage|null
*/
public function getStatusMessage(): ?PresenceStatusMessage {
$val = $this->getBackingStore()->get('statusMessage');
if (is_null($val) || $val instanceof PresenceStatusMessage) {
return $val;
}
throw new \UnexpectedValueException("Invalid type found in backing store for 'statusMessage'");
}

/**
* Serializes information the current object
* @param SerializationWriter $writer Serialization writer to use to serialize this model
*/
public function serialize(SerializationWriter $writer): void {
$writer->writeObjectValue('statusMessage', $this->getStatusMessage());
$writer->writeAdditionalData($this->getAdditionalData());
}

/**
* Sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
* @param array<string,mixed> $value Value to set for the additionalData property.
*/
public function setAdditionalData(?array $value): void {
$this->getBackingStore()->set('additionalData', $value);
}

/**
* Sets the backingStore property value. Stores model information.
* @param BackingStore $value Value to set for the backingStore property.
*/
public function setBackingStore(BackingStore $value): void {
$this->backingStore = $value;
}

/**
* Sets the statusMessage property value. The statusMessage property
* @param PresenceStatusMessage|null $value Value to set for the statusMessage property.
*/
public function setStatusMessage(?PresenceStatusMessage $value): void {
$this->getBackingStore()->set('statusMessage', $value);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

namespace Microsoft\Graph\Generated\Communications\Presences\Item\SetStatusMessage;

use Exception;
use Http\Promise\Promise;
use Http\Promise\RejectedPromise;
use Microsoft\Graph\Generated\Models\ODataErrors\ODataError;
use Microsoft\Kiota\Abstractions\BaseRequestBuilder;
use Microsoft\Kiota\Abstractions\HttpMethod;
use Microsoft\Kiota\Abstractions\RequestAdapter;
use Microsoft\Kiota\Abstractions\RequestInformation;

/**
* Provides operations to call the setStatusMessage method.
*/
class SetStatusMessageRequestBuilder extends BaseRequestBuilder
{
/**
* Instantiates a new SetStatusMessageRequestBuilder and sets the default values.
* @param array<string, mixed>|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL.
* @param RequestAdapter $requestAdapter The request adapter to use to execute the requests.
*/
public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) {
parent::__construct($requestAdapter, [], '{+baseurl}/communications/presences/{presence%2Did}/setStatusMessage');
if (is_array($pathParametersOrRawUrl)) {
$this->pathParameters = $pathParametersOrRawUrl;
} else {
$this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl];
}
}

/**
* Invoke action setStatusMessage
* @param SetStatusMessagePostRequestBody $body The request body
* @param SetStatusMessageRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
*/
public function post(SetStatusMessagePostRequestBody $body, ?SetStatusMessageRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toPostRequestInformation($body, $requestConfiguration);
try {
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings);
} catch(Exception $ex) {
return new RejectedPromise($ex);
}
}

/**
* Invoke action setStatusMessage
* @param SetStatusMessagePostRequestBody $body The request body
* @param SetStatusMessageRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return RequestInformation
*/
public function toPostRequestInformation(SetStatusMessagePostRequestBody $body, ?SetStatusMessageRequestBuilderPostRequestConfiguration $requestConfiguration = null): RequestInformation {
$requestInfo = new RequestInformation();
$requestInfo->urlTemplate = $this->urlTemplate;
$requestInfo->pathParameters = $this->pathParameters;
$requestInfo->httpMethod = HttpMethod::POST;
if ($requestConfiguration !== null) {
$requestInfo->addHeaders($requestConfiguration->headers);
$requestInfo->addRequestOptions(...$requestConfiguration->options);
}
$requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body);
return $requestInfo;
}

/**
* Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
* @param string $rawUrl The raw URL to use for the request builder.
* @return SetStatusMessageRequestBuilder
*/
public function withUrl(string $rawUrl): SetStatusMessageRequestBuilder {
return new SetStatusMessageRequestBuilder($rawUrl, $this->requestAdapter);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Microsoft\Graph\Generated\Communications\Presences\Item\SetStatusMessage;

use Microsoft\Kiota\Abstractions\BaseRequestConfiguration;
use Microsoft\Kiota\Abstractions\RequestOption;

/**
* Configuration for the request such as headers, query parameters, and middleware options.
*/
class SetStatusMessageRequestBuilderPostRequestConfiguration extends BaseRequestConfiguration
{
/**
* Instantiates a new setStatusMessageRequestBuilderPostRequestConfiguration and sets the default values.
* @param array<string, array<string>|string>|null $headers Request headers
* @param array<RequestOption>|null $options Request options
*/
public function __construct(?array $headers = null, ?array $options = null) {
parent::__construct($headers ?? [], $options ?? []);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap
* Read properties and relationships of the deviceAppManagement object.
* @param DeviceAppManagementRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @link https://learn.microsoft.com/graph/api/intune-partnerintegration-deviceappmanagement-get?view=graph-rest-1.0 Find more info here
* @link https://learn.microsoft.com/graph/api/intune-policyset-deviceappmanagement-get?view=graph-rest-1.0 Find more info here
*/
public function get(?DeviceAppManagementRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toGetRequestInformation($requestConfiguration);
Expand All @@ -175,7 +175,7 @@ public function get(?DeviceAppManagementRequestBuilderGetRequestConfiguration $r
* @param DeviceAppManagement $body The request body
* @param DeviceAppManagementRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @link https://learn.microsoft.com/graph/api/intune-books-deviceappmanagement-update?view=graph-rest-1.0 Find more info here
* @link https://learn.microsoft.com/graph/api/intune-policyset-deviceappmanagement-update?view=graph-rest-1.0 Find more info here
*/
public function patch(DeviceAppManagement $body, ?DeviceAppManagementRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ public function delete(?ManagedAppPolicyItemRequestBuilderDeleteRequestConfigura
}

/**
* Read properties and relationships of the targetedManagedAppProtection object.
* Read properties and relationships of the managedAppConfiguration object.
* @param ManagedAppPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappprotection-get?view=graph-rest-1.0 Find more info here
* @link https://learn.microsoft.com/graph/api/intune-mam-managedappconfiguration-get?view=graph-rest-1.0 Find more info here
*/
public function get(?ManagedAppPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toGetRequestInformation($requestConfiguration);
Expand Down Expand Up @@ -113,7 +113,7 @@ public function toDeleteRequestInformation(?ManagedAppPolicyItemRequestBuilderDe
}

/**
* Read properties and relationships of the targetedManagedAppProtection object.
* Read properties and relationships of the managedAppConfiguration object.
* @param ManagedAppPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return RequestInformation
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Microsoft\Kiota\Abstractions\QueryParameter;

/**
* Read properties and relationships of the targetedManagedAppProtection object.
* Read properties and relationships of the managedAppConfiguration object.
*/
class ManagedAppPolicyItemRequestBuilderGetQueryParameters
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap
* @param TargetAppsPostRequestBody $body The request body
* @param TargetAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @link https://learn.microsoft.com/graph/api/intune-mam-managedappprotection-targetapps?view=graph-rest-1.0 Find more info here
* @link https://learn.microsoft.com/graph/api/intune-mam-managedapppolicy-targetapps?view=graph-rest-1.0 Find more info here
*/
public function post(TargetAppsPostRequestBody $body, ?TargetAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toPostRequestInformation($body, $requestConfiguration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap
}

/**
* List properties and relationships of the managedAppPolicy objects.
* List properties and relationships of the managedAppConfiguration objects.
* @param ManagedAppPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @link https://learn.microsoft.com/graph/api/intune-mam-managedapppolicy-list?view=graph-rest-1.0 Find more info here
* @link https://learn.microsoft.com/graph/api/intune-mam-managedappconfiguration-list?view=graph-rest-1.0 Find more info here
*/
public function get(?ManagedAppPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toGetRequestInformation($requestConfiguration);
Expand Down Expand Up @@ -91,7 +91,7 @@ public function post(ManagedAppPolicy $body, ?ManagedAppPoliciesRequestBuilderPo
}

/**
* List properties and relationships of the managedAppPolicy objects.
* List properties and relationships of the managedAppConfiguration objects.
* @param ManagedAppPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return RequestInformation
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Microsoft\Kiota\Abstractions\QueryParameter;

/**
* List properties and relationships of the managedAppPolicy objects.
* List properties and relationships of the managedAppConfiguration objects.
*/
class ManagedAppPoliciesRequestBuilderGetQueryParameters
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap
* @param TargetAppsPostRequestBody $body The request body
* @param TargetAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @link https://learn.microsoft.com/graph/api/intune-mam-managedappprotection-targetapps?view=graph-rest-1.0 Find more info here
* @link https://learn.microsoft.com/graph/api/intune-mam-managedapppolicy-targetapps?view=graph-rest-1.0 Find more info here
*/
public function post(TargetAppsPostRequestBody $body, ?TargetAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toPostRequestInformation($body, $requestConfiguration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap
* @param TargetAppsPostRequestBody $body The request body
* @param TargetAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @link https://learn.microsoft.com/graph/api/intune-mam-managedappprotection-targetapps?view=graph-rest-1.0 Find more info here
* @link https://learn.microsoft.com/graph/api/intune-mam-managedapppolicy-targetapps?view=graph-rest-1.0 Find more info here
*/
public function post(TargetAppsPostRequestBody $body, ?TargetAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toPostRequestInformation($body, $requestConfiguration);
Expand Down
Loading