Git Product home page Git Product logo

cronofy-php's People

Contributors

adambird avatar adamwhittingham avatar andrewapplicantpro avatar andrewseward avatar colbeanz avatar cronofymatt avatar dprevite avatar grajo avatar gshutler avatar haziba avatar jack97 avatar jacobsmith avatar jantydlacka avatar jht89 avatar kgrab75 avatar kr-mykyta avatar lekoala avatar manudoni avatar mkarnicki avatar nevett avatar qmeister avatar robjmills avatar slavo2 avatar snake14 avatar splagemann avatar stephenbinns avatar tomhazledine avatar twithers avatar victor-cronofy avatar yitznewton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cronofy-php's Issues

Wrong parameters for Cronofy\Exception\CronofyException

This error seems to occur when the cronofy API returns 429 (Too Many Requests).

Error: Wrong parameters for Cronofy\Exception\CronofyException([string $message [, long $code [, Throwable $previous = NULL]]]) in /vendor/cronofy/cronofy/src/Exception/CronofyException.php:15
Stack trace:
#0 /vendor/cronofy/cronofy/src/Exception/CronofyException.php(15): Exception->__construct(NULL, 429, NULL)
#1 /vendor/cronofy/cronofy/src/Cronofy.php(1109): Cronofy\Exception\CronofyException->__construct(NULL, 429, '')
#2 /vendor/cronofy/cronofy/src/Cronofy.php(76): Cronofy\Cronofy->handleResponse('', 429)
#3 /vendor/cronofy/cronofy/src/Cronofy.php(86): Cronofy\Cronofy->baseHttpGet('/v1/availabilit...', Array, Array)
#4 /vendor/cronofy/cronofy/src/Cronofy.php(972): Cronofy\Cronofy->httpGet('/v1/availabilit...')

CronofyException is tried to be initialized with NULL, 429, NULL, but CronofyException requires a message, which is normally taken from $http_codes which does not include a message for 429

Cannot delete events

I can't delete or update events that are externally created although I get back a 202 HTTP response when I try to make that request.

Yet those created by my application are instantly deleted. How does that work? Do I need to be a subscriber?

Question - where is the notification payload documentation?

Hi, I was reviewing Cronofy notification channels to listen for events. I can't find where the actual notification/webhook payload is documented. Could you please point me at it or, if not documented, provide the expected payload format? Thanks!

Error Handling

It looks like when errors occur, only the 'error' value is returned while the API indicates that there might also be the 'error_description' and 'error_uri' fields. It would be nice to have access to those for logging when errors occur. I also didn't see any testing of error conditions in the unit tests. It would probably be useful to test error results for each function. That would also provide example code of how errors are handled in this library. Just some thoughts.

Implement \Iterator on PagedResultIterator

Hi there.

Right now, dealing with events is not friendly at all.

If PagedResultIterator implement \Iterator SPL interface.
Developers could use map functions to do the following:

$events = $cronofy->read_events();

$summaries = array_map(function(array $event) {
  return $event['summary'];
}, iterator_to_array($events));

It's just an example; but It could be really useful for many use-cases.

Regards;
Thomas.

Composer

I was looking to set this up in composer. I believe it would be easier to do this if their was a tag created so composer could use the tag as a version number. Please let me know if you agree or have other suggestions on using composer for this project.

Thank you,
John

429 HTTP code doesn't list in the library that causes [ErrorException] Undefined offset: 429

If you open Cronofy.php and find $http_codes array, you will see that the 429 status and several others not described. But I'm getting this error from Cronofy service and see the next exception:
[ErrorException] Undefined offset: 429
Stack trace
ErrorException: Undefined offset: 429 in /home/vagrant/***/vendor/cronofy/cronofy/src/Cronofy.php:1081 Stack trace: #0 /home/vagrant/***/vendor/sentry/sentry/lib/Raven/Breadcrumbs/ErrorHandler.php(34): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined offse...', '/home/vagrant/b...', 1081, Array) #1 /home/vagrant/***/vendor/cronofy/cronofy/src/Cronofy.php(1081): Raven_Breadcrumbs_ErrorHandler->handleError(8, 'Undefined offse...', '/home/vagrant/b...', 1081, Array) #2 /home/vagrant/***/vendor/cronofy/cronofy/src/Cronofy.php(76): Cronofy\Cronofy->handleResponse('', 429) #3 /home/vagrant/***/vendor/cronofy/cronofy/src/Cronofy.php(86): Cronofy\Cronofy->baseHttpGet('/v1/userinfo', Array, Array) #4 /home/vagrant/***/vendor/cronofy/cronofy/src/Cronofy.php(369): Cronofy\Cronofy->httpGet('/v1/userinfo')

image

Post and delete request do not return responses

Not sure if this is a problem for the sdk itself or on cronofy's end, but post and delete request return empty responses "" which is really odd. Get request are fine though, so it doesn't seem related to improper usage of the sdk.

By running a verbose curl call, this part seems relevant

...

  • Connection state changed (MAX_CONCURRENT_STREAMS == 128)!\n
  • We are completely uploaded and fine\n
    < HTTP/2 202 \r\n
    ...

I thought that maybe it was an issue with HTTP2 so I tried forcing HTTP 1 but that doesn't work any better...

Missing Response Data

While using the request_token method, I noticed that most of the response JSON is discarded. When I request an access token, using Postman, I receive the following values back:

{
"access_token": "masked",
"token_type": "bearer",
"expires_in": 10800,
"refresh_token": "masked",
"scope": "create_event delete_event read_events",
"sub": "masked",
"account_id": "masked",
"linking_profile": {
"provider_name": "google",
"profile_id": "masked",
"profile_name": "masked"
}
}

The Cronofy class only saves access_token, expires_in, and refresh_token. Is that intentional? I just think that some users, like myself, would like access to the other returned values. It can be frustrating to read in the about available fields in the API Docs only to look through the PHP library code and find out that the library doesn't make them available.

Additional tests

In particular at least one test for a DELETE method and the iterator for read_events would make this much easier to work with

PHP8 Support

Just curious as to when/if there will by PHP8 support.

Problem 1
    - cronofy/cronofy[v1.4.0, ..., v1.x-dev] require php ^7.1 -> your php version (8.0.7) does not satisfy that requirement.
   

Thanks in advance.

Batch endpoint support

Hi Guys,

It doesn't look like the batch endpoint has been exposed by the PHP client.

I can see that it exists in the Ruby client - my question is, would you be receptive to a PR if I modelled the functionality around the Ruby client's implementation?

Cheers,
Jack

No Autoloading

With composer, autoloading should be enabled to allow the files to be autoloaded into the project. I created a pull request adding that and a .gitignore file to ignore the vendor directory created when installing the package via composer. #20

real_time_scheduling method doesn't support all parameters

I've run into the issue that the Cronofy->real_time_scheduling method doesn't support a parameter that I need. I tried providing the formatting.hour_format parameter detailed in the Cronofy API Docs, but it doesn't get included in the POST. I looked in the code for that method and it appears that the parameter is omitted from the POST fields:

$postfields = array(
    "client_id" => $this->client_id,
    "client_secret" => $this->client_secret,
    "oauth" => $params["oauth"],
    "event" => $params["event"],
    "availability" => $params["availability"],
    "target_calendars" => $params["target_calendars"],
    "tzid" => $params["tzid"],
);

Could someone please add that in? Thank you.

P.S. I also just noticed that it doesn't support the callback_url parameter either.

Create Event Response Blank.

I am unable to get response for Create Event using PHP api and even on PostMan Api call.
If I add include_userinfo as true then only getting users info but not getting event id or event_uid.

Sample params sent :
Param = {
"event_id": "asdfg123456789asas54as5s",
"summary": "Dev Amit meeting",
"description": "Discuss plans for the next quarter.",
"start": "2020-07-31T05:30:00Z",
"end": "2020-07-31T06:30:00Z",
"tzid" : "Asia/Kolkata",
"location": {
"description": "Board room"
},
"include_userinfo" : true
}
Thank you.

Non Root Namespace

Would be nice if all the classes were available under a non root namespace e.g. Cronofy.

Probably requires a major version bump if you make that change though.

\CurlRequest and \HttpRequest in particular are maybe a bit worrying.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.