cronofy / cronofy-php Goto Github PK
View Code? Open in Web Editor NEWCronofy PHP library
Home Page: https://docs.cronofy.com/developers
License: MIT License
Cronofy PHP library
Home Page: https://docs.cronofy.com/developers
License: MIT License
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.
It looks like all the methods expect these parameters but never use them. they always use the variables that were set in the constructor
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
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!
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
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?
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
The locale parameter is not being recognized and passed through when using upsertEvent, so using template variables generates an error: "errors.required_for_templating"
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
In particular at least one test for a DELETE method and the iterator for read_events would make this much easier to work with
Is it possible to attach a file when upserting an event?
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.
Are we sure, that we want to separate scopes in getAuthorizationURL
by literal spaces?
https://github.com/cronofy/cronofy-php/blob/master/cronofy.php#L233
While it might work in (some) web-browser, I suppose better practice would be to escape it.
https://stackoverflow.com/questions/497908/is-a-url-allowed-to-contain-a-space
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
...
I thought that maybe it was an issue with HTTP2 so I tried forcing HTTP 1 but that doesn't work any better...
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.
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')
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.
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.
Would it be possible to move documentation in docblocks instead of inside the method? that would be so much more IDE friendly!
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.
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.
The requestToken function returns a boolean, instead of the actual refresh token and access token that needs to be saved for future use, as it states in the docs, issue is here:
Line 297 in 5bcb4d1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.