microsoftgraph / msgraph-sdk-php

Microsoft Graph Library for PHP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need for getId() methods on Microsoft\Graph\Generated\Models\AuthenticationMethods

Teejer opened this issue · comments

I think it would make a lot of sense to have getId methods on all authenticationmethod classes. I have a need for that in a home grown admin tool for managing many of our systems in one place. In this case being able to remove authentication methods using the graph api through php.

If I had a getId() method on all the different auth types then I could add that info into a table that has all their auth methods and then call the delete methods with the id, without having to do some other kind of additional lookup.

$graphServiceClient->users()->byUserId($username)->authentication()->phoneMethods()->byPhoneAuthenticationMethodId($phoneId)->delete()->wait()

unless there is a different way to find the authmedthod besides byPhoneAuthenticationMethodId? Or the like for other auth methods?

I think it would look something like this:

/**
 * Gets the id property value. 
 * @return string|null
*/
public function getId(): ?string {
    $val = $this->getBackingStore()->get('id');
    if (is_null($val[1]) || is_string($val[1])) {
        return $val;
    }
    throw new \UnexpectedValueException("Invalid type found in backing store for 'id'");
}

@Teejer getId() already exists for all the authentication method classes. It's inherited from the Entity model.