Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use Assets API #795

Open
twhite94 opened this issue Feb 25, 2021 · 2 comments
Open

Unable to use Assets API #795

twhite94 opened this issue Feb 25, 2021 · 2 comments

Comments

@twhite94
Copy link

Hello,

Firstly I just want to say THANK YOU for this amazing package. At the startup I work at we've been using xero-php fairly extensively for the last ~2 years and it's been great. I'm usually able to find solutions to the problems I'd had by just reading the docs or issue threads.

While I've only ever previously used the Accounting API, I now have a need to use the Assets API.

I assumed that I would be able to do something as simple as:

$application->load(XeroPHP\Models\Assets\Asset::class)->execute()

in order to retrieve assets (as per https://developer.xero.com/documentation/assets-api/assets) but this class doesn't exist. What's the correct way of doing this?

When I try something similar with AssetType I get the error Invalid API passed to XeroPHP\URL::__construct(). Must be XeroPHP\URL::API_*

It appears that the api stem for AssetType (Remote\URL::API_ASSET) doesn't have a matching case in the switch statement near the bottom of XeroPHP\Remote\URL.php

Are you able to offer any help? An examples you can provide would be fantastic as there don't appear to be any.

Many thanks,

Tim

@calcinai
Copy link
Owner

Hi TIm,

I've not actually used or tested the Assets API so excuse me if this is a little unhelpful.

This project originally scraped the documentation website, and created models in folders that corresponded to the page structure. Since the docs have now significantly changed, they're updated manually.

The Assets API was added (afaik) during this transition, so is likely incomplete. It could be as simple as adding that constant as you suggest and maybe a model for the Asset itself. I know that early on, Assets were in the Accounting API, so this is probably why it goy messy...

@twhite94
Copy link
Author

twhite94 commented Mar 3, 2021

Hi Michael,

Thanks for your reply. I've created a fork and am currently working on writing this logic myself, but it's not ready for public consumption just yet.

I'll probably have a PR for you in the next week or so.

Tim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants