team-telnyx / telnyx-php

PHP SDK for the Telnyx API
MIT License
33 stars 26 forks source link

Modified the delete method to be able to be called statically #44

Closed kevinkorb closed 3 years ago

kevinkorb commented 3 years ago

I was getting an error saying the Delete could not be called statically, per the documentation on Telnyx's site, it was supposed to be called statically, which matches how you use the rest of the API.

weroh commented 3 years ago

Hey @kevinkorb, thanks for submitting this modification. The delete method is supposed to look like this:

$result = \Telnyx\SomeEndpoint::get($id); $result->delete();

Updates are similar $result = \Telnyx\SomeEndpoint::get($id); $result->update(['field' => 'value']);

I've sent a note to the team about the docs and will be in touch regarding next steps.

kevinkorb commented 3 years ago

Got it, thanks.

From the Telnyx site/docs, it appeared everything was done statically, this makes sense though.

On Dec 11, 2020, 9:31 AM -0600, weroh notifications@github.com, wrote:

Hey @kevinkorb, thanks for submitting this modification. The delete method is supposed to look like this: $result = \Telnyx\SomeEndpoint::get($id); $result->delete(); Updates are similar $result = \Telnyx\SomeEndpoint::get($id); $result->update(['field' => 'value']); I've sent a note to the team about the docs and will be in touch regarding next steps. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

weroh commented 3 years ago

@kevinkorb This design was carried over from the Stripe API.

Also, I actually made a mistake. It's supposed to be $result->save($opts). However, \Telnyx\SomeEndpoint::update($id, $opts) is also valid. Currently, delete() is the only method that can't be called statically.

Thanks for your input! Keeping it in mind for near-future updates.

d-telnyx commented 3 years ago

@kevinkorb updated in 45 where delete remains the same; however remove has been added to be called statically. I'm publishing update now