AgentPushKit-Client

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

returned by and sent to the methods on the endpoints.

An API factory class is provided, which builds instances of each endpoint API.

This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it.

For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.

## Configuring authentication

In the normal case, the OpenAPI Spec will describe what parameters are
required and where to put them. You just need to supply the tokens.

    my $tokens = {
        # basic
        username => $username,
        password => $password,

        # oauth
        access_token => $oauth_token,

        # keys
        $some_key => { token => $token,
                       prefix => $prefix,
                       in => $in,             # 'head||query',
                       },

        $another => { token => $token,
                      prefix => $prefix,
                      in => $in,              # 'head||query',
                      },
        ...,

        };

        my $api = MyApp->new({ tokens => $tokens });

Note these are all optional, as are `prefix` and `in`, and depend on the API
you are accessing. Usually `prefix` and `in` will be determined by the code generator from
the spec and you will not need to set them at run time. If not, `in` will
default to 'head' and `prefix` to the empty string.

The tokens will be placed in a L<AgentPushKit::Client::Configuration> instance
as follows, but you don't need to know about this.

- `$cfg->{username}`

    String. The username for basic auth.

- `$cfg->{password}`

    String. The password for basic auth.

- `$cfg->{api_key}`

    Hashref. Keyed on the name of each key (there can be multiple tokens).

            $cfg->{api_key} = {
                    secretKey => 'aaaabbbbccccdddd',
                    anotherKey => '1111222233334444',
                    };

- `$cfg->{api_key_prefix}`

    Hashref. Keyed on the name of each key (there can be multiple tokens). Note not
    all api keys require a prefix.

            $cfg->{api_key_prefix} = {
                    secretKey => 'string',
                    anotherKey => 'same or some other string',
                    };

- `$cfg->{access_token}`

    String. The OAuth access token.

# METHODS

## `base_url`

The generated code has the `base_url` already set as a default value. This method
returns the current value of `base_url`.

## `api_factory`

Returns an API factory object. You probably won't need to call this directly.

        $self->api_factory('Pet'); # returns a AgentPushKit::Client::PetApi instance

        $self->pet_api;            # the same

# MISSING METHODS

Most of the methods on the API are delegated to individual endpoint API objects
(e.g. Pet API, Store API, User API etc). Where different endpoint APIs use the
same method name (e.g. `new()`), these methods can't be delegated. So you need
to call `$api->pet_api->new()`.

In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for:

        new()
        class_documentation()
        method_documentation()

To call these methods, you need to get a handle on the relevant object, either
by calling `$api->foo_api` or by retrieving an object, e.g.
`$api->get_pet_by_id(pet_id => $pet_id)`. They are class methods, so
you could also call them on class names.

# BUILDING YOUR LIBRARY

See the homepage `https://openapi-generator.tech` for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed.

The config file should specify the project name for the generated library:

        {"moduleName":"WWW::MyProjectName"}

Your library files will be built under `WWW::MyProjectName`.

          $ git clone https://github.com/openapitools/openapi-generator
          $ cd openapi-generator
          $ mvn package
          $ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
    -i [URL or file path to JSON OpenAPI API spec] \

README.md  view on Meta::CPAN

use AgentPushKit::Client::Object::InheritedResponse;
use AgentPushKit::Client::Object::Membership;
use AgentPushKit::Client::Object::MembershipUser;
use AgentPushKit::Client::Object::Organization;
use AgentPushKit::Client::Object::OrganizationApiKeyCreated;
use AgentPushKit::Client::Object::OrganizationCount;
use AgentPushKit::Client::Object::OrganizationCreated;
use AgentPushKit::Client::Object::OrganizationRecord;
use AgentPushKit::Client::Object::PasswordLoginInput;
use AgentPushKit::Client::Object::PasswordResetCompleteInput;
use AgentPushKit::Client::Object::PasswordResetRequestInput;
use AgentPushKit::Client::Object::PreferenceRecord;
use AgentPushKit::Client::Object::ProviderLoginInput;
use AgentPushKit::Client::Object::RegisterDeviceInput;
use AgentPushKit::Client::Object::RegisterInput;
use AgentPushKit::Client::Object::RegisterWebPushSubscriptionInput;
use AgentPushKit::Client::Object::RegisterWebPushSubscriptionInputKeys;
use AgentPushKit::Client::Object::RevokedResponse;
use AgentPushKit::Client::Object::SearchEventsInput;
use AgentPushKit::Client::Object::SendEventInput;
use AgentPushKit::Client::Object::Service;
use AgentPushKit::Client::Object::ServiceAllOfCount;
use AgentPushKit::Client::Object::ServicePreference;
use AgentPushKit::Client::Object::ServiceSummary;
use AgentPushKit::Client::Object::SetEnabledInput;
use AgentPushKit::Client::Object::TextFilterCondition;
use AgentPushKit::Client::Object::TimeFilterCondition;
use AgentPushKit::Client::Object::TypeOverride;
use AgentPushKit::Client::Object::User;
use AgentPushKit::Client::Object::WebPushConfiguration;
use AgentPushKit::Client::Object::WebPushSubscription;

# for displaying the API response data
use Data::Dumper;


my $api_instance = AgentPushKit::Client::AccountApi->new(
);


eval {
    my $result = $api_instance->delete_current_account();
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountApi->delete_current_account: $@\n";
}

```

# DOCUMENTATION FOR API ENDPOINTS

All URIs are relative to *https://api.chatdna.co/agent-push-kit/v1*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AccountApi* | [**delete_current_account**](docs/AccountApi.md#delete_current_account) | **DELETE** /me | Delete the current user and customer accounts they own
*AccountApi* | [**get_current_account**](docs/AccountApi.md#get_current_account) | **GET** /me | Get the current user and customer accounts
*AgentTokensApi* | [**call_mcp**](docs/AgentTokensApi.md#call_mcp) | **POST** /mcp | Connect through stateless MCP Streamable HTTP
*AgentTokensApi* | [**create_agent_token**](docs/AgentTokensApi.md#create_agent_token) | **POST** /agent-tokens | Create a named non-expiring agent token
*AgentTokensApi* | [**list_agent_tokens**](docs/AgentTokensApi.md#list_agent_tokens) | **GET** /agent-tokens | List agent access tokens without their secrets
*AgentTokensApi* | [**revoke_agent_token**](docs/AgentTokensApi.md#revoke_agent_token) | **DELETE** /agent-tokens/{tokenId} | Revoke one of the current user&#39;s agent tokens
*AuthenticationApi* | [**complete_password_reset**](docs/AuthenticationApi.md#complete_password_reset) | **POST** /auth/password-reset/complete | Choose a new password and log in
*AuthenticationApi* | [**login_with_apple**](docs/AuthenticationApi.md#login_with_apple) | **POST** /auth/apple | Log in or attach an account using a Sign in with Apple identity token
*AuthenticationApi* | [**login_with_google**](docs/AuthenticationApi.md#login_with_google) | **POST** /auth/google | Log in or attach an account using a verified Google ID token
*AuthenticationApi* | [**login_with_password**](docs/AuthenticationApi.md#login_with_password) | **POST** /auth/login | Log in with email and password
*AuthenticationApi* | [**register**](docs/AuthenticationApi.md#register) | **POST** /auth/register | Create a user and first customer account
*AuthenticationApi* | [**request_password_reset**](docs/AuthenticationApi.md#request_password_reset) | **POST** /auth/password-reset/request | Email a single-use password reset token
*CustomerAccountsApi* | [**add_organization_member**](docs/CustomerAccountsApi.md#add_organization_member) | **POST** /organizations/{organizationId}/members | Add an already-registered user to a customer account
*CustomerAccountsApi* | [**create_organization**](docs/CustomerAccountsApi.md#create_organization) | **POST** /organizations | Create another Agent Push Kit customer account
*CustomerAccountsApi* | [**list_organization_members**](docs/CustomerAccountsApi.md#list_organization_members) | **GET** /organizations/{organizationId}/members | List members of a customer account
*CustomerAccountsApi* | [**list_organizations**](docs/CustomerAccountsApi.md#list_organizations) | **GET** /organizations | List customer accounts available to the current user
*CustomerAccountsApi* | [**regenerate_organization_api_key**](docs/CustomerAccountsApi.md#regenerate_organization_api_key) | **POST** /organizations/{organizationId}/api-key/regenerate | Rotate the application event-ingestion key
*DevicesApi* | [**get_web_push_configuration**](docs/DevicesApi.md#get_web_push_configuration) | **GET** /web-push/configuration | Get browser push availability and its public VAPID key
*DevicesApi* | [**register_device**](docs/DevicesApi.md#register_device) | **POST** /devices | Register or refresh an APNs device
*DevicesApi* | [**register_web_push_subscription**](docs/DevicesApi.md#register_web_push_subscription) | **POST** /web-push/subscriptions | Register or refresh a browser push subscription
*DevicesApi* | [**remove_device**](docs/DevicesApi.md#remove_device) | **DELETE** /devices/{installationId} | Disable push delivery to one installation
*DevicesApi* | [**remove_web_push_subscription**](docs/DevicesApi.md#remove_web_push_subscription) | **DELETE** /web-push/subscriptions/{subscriptionId} | Disable a browser push subscription
*EventsApi* | [**get_event**](docs/EventsApi.md#get_event) | **GET** /organizations/{organizationId}/events/{eventId} | Get one event including metadata
*EventsApi* | [**list_events**](docs/EventsApi.md#list_events) | **GET** /organizations/{organizationId}/events | List a paginated inbox
*EventsApi* | [**list_notification_types**](docs/EventsApi.md#list_notification_types) | **GET** /organizations/{organizationId}/types | List distinct notification types
*EventsApi* | [**list_services**](docs/EventsApi.md#list_services) | **GET** /organizations/{organizationId}/services | List services discovered from ingested events
*EventsApi* | [**search_events**](docs/EventsApi.md#search_events) | **POST** /organizations/{organizationId}/events/search | Search events with a validated Boolean filter tree
*EventsApi* | [**send_event**](docs/EventsApi.md#send_event) | **POST** /events | Send an event using an application ingestion key
*EventsApi* | [**send_event_as_user**](docs/EventsApi.md#send_event_as_user) | **POST** /organizations/{organizationId}/events | Send an event as an authenticated user or agent
*HealthApi* | [**get_health**](docs/HealthApi.md#get_health) | **GET** /health | Check Agent Push Kit API health
*PreferencesApi* | [**list_preferences**](docs/PreferencesApi.md#list_preferences) | **GET** /organizations/{organizationId}/preferences | List service defaults and exact-type overrides
*PreferencesApi* | [**remove_type_preference**](docs/PreferencesApi.md#remove_type_preference) | **DELETE** /services/{serviceId}/types/{type}/preference | Remove an exact-type override so it inherits the service default
*PreferencesApi* | [**set_service_preference**](docs/PreferencesApi.md#set_service_preference) | **PUT** /services/{serviceId}/preference | Enable or disable pushes for a service by default
*PreferencesApi* | [**set_type_preference**](docs/PreferencesApi.md#set_type_preference) | **PUT** /services/{serviceId}/types/{type}/preference | Override push delivery for one exact notification type


# DOCUMENTATION FOR MODELS
 - [AgentPushKit::Client::Object::AcceptedResponse](docs/AcceptedResponse.md)
 - [AgentPushKit::Client::Object::AddMemberInput](docs/AddMemberInput.md)
 - [AgentPushKit::Client::Object::AgentToken](docs/AgentToken.md)
 - [AgentPushKit::Client::Object::AgentTokenCreated](docs/AgentTokenCreated.md)
 - [AgentPushKit::Client::Object::ApiKeySummary](docs/ApiKeySummary.md)
 - [AgentPushKit::Client::Object::AuthResponse](docs/AuthResponse.md)
 - [AgentPushKit::Client::Object::CreateAgentTokenInput](docs/CreateAgentTokenInput.md)
 - [AgentPushKit::Client::Object::CreateOrganizationInput](docs/CreateOrganizationInput.md)
 - [AgentPushKit::Client::Object::CurrentAccount](docs/CurrentAccount.md)
 - [AgentPushKit::Client::Object::DeletedResponse](docs/DeletedResponse.md)
 - [AgentPushKit::Client::Object::DeliverySummary](docs/DeliverySummary.md)
 - [AgentPushKit::Client::Object::Device](docs/Device.md)
 - [AgentPushKit::Client::Object::DisabledResponse](docs/DisabledResponse.md)
 - [AgentPushKit::Client::Object::ErrorResponse](docs/ErrorResponse.md)
 - [AgentPushKit::Client::Object::EventDetail](docs/EventDetail.md)
 - [AgentPushKit::Client::Object::EventFilter](docs/EventFilter.md)
 - [AgentPushKit::Client::Object::EventPage](docs/EventPage.md)
 - [AgentPushKit::Client::Object::EventSummary](docs/EventSummary.md)
 - [AgentPushKit::Client::Object::FilterGroup](docs/FilterGroup.md)
 - [AgentPushKit::Client::Object::FilterNot](docs/FilterNot.md)
 - [AgentPushKit::Client::Object::HealthResponse](docs/HealthResponse.md)
 - [AgentPushKit::Client::Object::IngestionResult](docs/IngestionResult.md)
 - [AgentPushKit::Client::Object::InheritedResponse](docs/InheritedResponse.md)
 - [AgentPushKit::Client::Object::Membership](docs/Membership.md)
 - [AgentPushKit::Client::Object::MembershipUser](docs/MembershipUser.md)
 - [AgentPushKit::Client::Object::Organization](docs/Organization.md)
 - [AgentPushKit::Client::Object::OrganizationApiKeyCreated](docs/OrganizationApiKeyCreated.md)
 - [AgentPushKit::Client::Object::OrganizationCount](docs/OrganizationCount.md)



( run in 0.810 second using v1.01-cache-2.11-cpan-d01c6094234 )