boldare / salesforce-client Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Currently we have only one group. I can imagine some specific cases when something should be able to set only on create.
Sometimes a return type is specified and other times it is not.
For example, no return type here even though it has to be a bool.
https://github.com/xsolve-pl/salesforce-client/blob/master/src/Model/Account.php#L363
Btw. PHP 7 doesn't allow returning nulls when you have a return type declared.
On the other hand this has a return type, but no docblock https://github.com/xsolve-pl/salesforce-client/blob/master/src/Model/Account.php#L648
Is this by choice? I can understand no docblocks for simple methods with type declarations, but here it's pretty inconsistent.
I guess https://github.com/xsolve-pl/salesforce-client/blob/master/Model/Address.php isn't really a standalone model which could be used by the Salesforce object repository but it's rather a value object which aggregates multiple scalars from the same context. For that I'd create separate ValueObject
namespace within the Xsolve\SalesforceClient\Model\
one.
The services which link Packagist to the repository are deprecated:
This package is using the legacy GitHub service and will stop being auto-updated in early 2019. Please set up the new GitHub Hook for Packagist so that it keeps working in the future.
The repository should be updated following the Packagist documentation linked above.
In https://github.com/xsolve-pl/salesforce-client/blob/master/composer.json the Guzzle lib is in the suggest
section but actually it's required and without it the API client won't work at all as we don't have any other implementations of the client.
Consider moving serialization configurations into it's own file, in my opinion it would make the code and the configuration itself more readable.
It seems to me that NotFoundException has nothing in common with AuthorizationFailedException. https://github.com/xsolve-pl/salesforce-client/blob/master/Security/Authentication/Strategy/NotFoundException.php
It would be very handy to add direct links to Salesforce docs for the instructions introduced in #77
I don't find https://github.com/xsolve-pl/salesforce-client/blob/master/Security/Authentication/CredentialsInterface.php useful, most probably there won't be any other implementation. The ArrayCredentials
class could become just Credentials
and accept the values as scalars in the constructor.
PHPUnit is currently fixed to version 5.5.*, should be bumped to the latest 6. When there is PHP 7.0 EOL announced we should switch to the version 7.
I don't think that a Get extending Update is logical. If I'm wrong please enlighten me a bit ;) If it's only about the same endpoint name I think we can afford that duplication in favor of having logically decoupled classes.
It would be nice to integrate httplug, which standardize http client interface.
The benefit of this solution is that users does not have to adjust their http clients to implement Xsolve\SalesforceClient\Http\ClientInterface
. (Most of available clients already implement HttpClient
from httplug package
Please add some more information (preferably in docblock) what an implementation of https://github.com/xsolve-pl/salesforce-client/blob/master/Security/Authentication/Strategy/RegenerateStrategyInterface.php should exactly do in the getCredentials()
method. I find it weird that it accepts a CredentialsInterface instance and should return an instance of the same type, should it modify its state somehow?
Besides, the support()
method could be renamed to supports()
to make it more English :)
In order to have all the requests being sent to the Salesforce API stored in unified manner we could research if it's possible to move Authenticator::getRequest() logic to separate class which would implement RequestInterface
like all other requests.
We don't have any precise coding standards set yet but as default I'd use combination of http://symfony.com/doc/current/contributing/code/standards.html and PRS's. We should set up PHP CS Fixer and scan the project. First thing I found is abstract
keyword which should go before the method's visibility https://github.com/xsolve-pl/salesforce-client/blob/master/Model/AbstractSObject.php but probably there will be more.
Not the top priority though so you can pick it up later on.
Hello,
I'm following the documentation but I cannot make any doRequest, all I get is the following :
In Authenticator.php line 44:
Authentication request failed.
In Promise.php line 127:
Client error: `POST https://test.salesforce.com/services/oauth2/token` resulted in a `400 Bad Request` response:
{"error":"invalid_grant","error_description":"authentication failure"}
In RequestException.php line 113:
Client error: `POST https://test.salesforce.com/services/oauth2/token` resulted in a `400 Bad Request` response:
{"error":"invalid_grant","error_description":"authentication failure"}
Here is my code :
$client = new GuzzleAdapter(new Client([
'base_uri' => 'https://test.salesforce.com/',
]));
$securityToken = 'XXXXXX';
$credentials = new Credentials(
'MY_KEY',
'MY_SECRET',
'password',
[
'username' => 'MY_ACCOUNT',
'password' => 'MY_PASSWORD'.$securityToken,
]
);
$authenticator = new Authenticator(
$client,
[new PasswordGrantRegenerateStrategy()]
);
$tokenGenerator = new TokenGenerator(
$credentials,
$authenticator,
new RequestTokenStorage()
);
$salesforceClient = new SalesforceClient($client, $tokenGenerator, 'v37.0');
// print_r($salesforceClient);
$result = $salesforceClient->doRequest(new Query('SELECT Name FROM Account'));
I do not understand where the error come from, can you help me?
We could use enumeration which can be typehinted, this would allow to avoid sanity checks every time we set a status for instance. I suggest to use either https://github.com/eloquent/enumeration or simply http://php.net/manual/en/class.splenum.php
The key name should not be hardcoded in order to allow the users to change it to anything else if needed. https://github.com/xsolve-pl/salesforce-client/blob/master/Storage/RedisTokenStorage.php
I'd suggest to extend \RuntimeException
instead of generic \Exception
in https://github.com/xsolve-pl/salesforce-client/blob/master/Http/HttpException.php to make it more clear what's the exception about.
We must not use generic "managers" which allow anyone to add any next functionality directly there justifying that managers basically could do anything. I suggest to rename https://github.com/xsolve-pl/salesforce-client/blob/master/Manager/SObjectManager.php to ObjectRepository along with its interface. https://github.com/xsolve-pl/salesforce-client/blob/master/Manager/TokenManager.php could become TokenGenerator or something similar.
I think the https://github.com/xsolve-pl/salesforce-client/tree/master/Request/Object namespace doesn't bring any value and could be removed, the classes might be moved to https://github.com/xsolve-pl/salesforce-client/tree/master/Request
I'm getting this error after fixing the guzzle6-adapter issue earlier. Not getting this to work.
Problem 1
- php-http/guzzle6-adapter is locked to version v2.0.1 and an update of this package was not requested.
- xsolve-pl/salesforce-client[1.0.0, ..., v1.0.3] require php-http/httplug ^1.1 -> satisfiable by php-http/httplug[v1.1.0].
- Conclusion: don't install php-http/httplug v1.1.0 (conflict analysis result)
- Root composer.json requires xsolve-pl/salesforce-client ^1.0 -> satisfiable by xsolve-pl/salesforce-client[1.0.0, v1.0.1, v1.0.2, v1.0.3].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
No luck with composer require xsolve-pl/salesforce-client -W
either
Travis CI can be configured to execute its builds on different PHP versions. As PHP7.0 slowly becomes obsolete (it's not supported since 3.12.2017 and gets only security fixes) I think we should start analysing the codebase against newer versions. Moreover, we require PHP >7.0.0 in composer.json so it would be great to have some confirmation the code works well on newer ones as well.
The docblock in request()
method of https://github.com/xsolve-pl/salesforce-client/blob/master/Http/ClientInterface.php is missing the @return
. Could be also omitted (we use scalar typehints) but then we should also omit the @param
s to make it consistent.
We should use full name "Salesforce" instead of "S" prefix in all places. We can also try to remove that part as we have namespaces which tell what's the class' context.
After migrating to the boldare
namespace all the URLs in the documentation, especially the ones for badges should be updated. Moreover, the Scrutinizer project should be migrated accordingly.
Login to sandbox have different URL, we should let user choose.
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.