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

Add support for forms #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Services available so far:
- Lists
- Contacts
- Tags
- Forms

## Official API documentation

Expand Down Expand Up @@ -86,7 +87,7 @@ $paginated_lists = $ac->lists()->paginate(50)->all();

https://developers.activecampaign.com/v3/reference#section-ordering \
You can sort results in needed order. Use `->orderby()` method and pass as argument an array, where key is the name of field and value is order (asc or desc).

```php
// get all contacts and sort them by email in asc order and by last name in desc order
$contacts = $ac->contacts()->order(['email' => 'asc', 'lastName' => 'desc'])->all();
Expand Down
8 changes: 7 additions & 1 deletion src/ActiveCampaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Dhrechanyi\ActiveCampaign\Classes\Lists;
use Dhrechanyi\ActiveCampaign\Classes\Contacts;
use Dhrechanyi\ActiveCampaign\Classes\Tags;
use Dhrechanyi\ActiveCampaign\Classes\Forms;


class ActiveCampaign
Expand Down Expand Up @@ -33,4 +34,9 @@ public function tags()
return new Tags($this->base_url, $this->api_key);
}

}
public function forms()
{
return new Forms($this->base_url, $this->api_key);
}

}
22 changes: 22 additions & 0 deletions src/Classes/Forms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Dhrechanyi\ActiveCampaign\Classes;

use Dhrechanyi\ActiveCampaign\Connector;


class Forms extends Connector
{

public function get($form_id)
{
return $this->request('GET', 'forms/' . strval($form_id));
}


public function all()
{
return $this->request('GET', 'forms');
}

}