AgentPushKit-Client

 view release on metacpan or  search on metacpan

lib/AgentPushKit/Client/AuthenticationApi.pm  view on Meta::CPAN

=begin comment

Agent Push Kit API

The complete Agent Push Kit REST API. Application event ingestion uses an organization key beginning with `apk_`. Authenticated user operations accept either an Agent Push Kit login JWT or an agent access token beginning with `apt_`.

The version of the OpenAPI document: 0.1.0

Generated by: https://openapi-generator.tech

=end comment

=cut

#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# Do not edit the class manually.
# Ref: https://openapi-generator.tech
#
package AgentPushKit::Client::AuthenticationApi;

require 5.6.0;
use strict;
use warnings;
use utf8;
use Exporter;
use Carp qw( croak );
use Log::Any qw($log);

use AgentPushKit::Client::ApiClient;

use base "Class::Data::Inheritable";

__PACKAGE__->mk_classdata('method_documentation' => {});

sub new {
    my $class = shift;
    my $api_client;

    if ($_[0] && ref $_[0] && ref $_[0] eq 'AgentPushKit::Client::ApiClient' ) {
        $api_client = $_[0];
    } else {
        $api_client = AgentPushKit::Client::ApiClient->new(@_);
    }

    bless { api_client => $api_client }, $class;

}


#
# complete_password_reset
#
# Choose a new password and log in
#
# @param PasswordResetCompleteInput $password_reset_complete_input  (required)
{
    my $params = {
    'password_reset_complete_input' => {
        data_type => 'PasswordResetCompleteInput',
        description => '',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'complete_password_reset' } = {
        summary => 'Choose a new password and log in',
        params => $params,
        returns => 'AuthResponse',
        };
}
# @return AuthResponse
#
sub complete_password_reset {
    my ($self, %args) = @_;

    # verify the required parameter 'password_reset_complete_input' is set
    unless (exists $args{'password_reset_complete_input'}) {
      croak("Missing the required parameter 'password_reset_complete_input' when calling complete_password_reset");
    }

    # parse inputs
    my $_resource_path = '/auth/password-reset/complete';

    my $_method = 'POST';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    my $_header_accept = $self->{api_client}->select_header_accept('application/json');
    if ($_header_accept) {
        $header_params->{'Accept'} = $_header_accept;
    }
    $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');

    my $_body_data;
    # body params
    if ( exists $args{'password_reset_complete_input'}) {
        $_body_data = $args{'password_reset_complete_input'};
    }

    # authentication setting, if any
    my $auth_settings = [qw()];

    # make the API Call
    my $response = $self->{api_client}->call_api($_resource_path, $_method,
                                           $query_params, $form_params,
                                           $header_params, $_body_data, $auth_settings);
    if (!$response) {
        return;
    }
    my $_response_object = $self->{api_client}->deserialize('AuthResponse', $response);
    return $_response_object;
}

#
# login_with_apple
#
# Log in or attach an account using a Sign in with Apple identity token
#
# @param ProviderLoginInput $provider_login_input  (required)
{
    my $params = {
    'provider_login_input' => {
        data_type => 'ProviderLoginInput',
        description => '',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'login_with_apple' } = {
        summary => 'Log in or attach an account using a Sign in with Apple identity token',
        params => $params,
        returns => 'AuthResponse',
        };
}
# @return AuthResponse
#
sub login_with_apple {
    my ($self, %args) = @_;

    # verify the required parameter 'provider_login_input' is set
    unless (exists $args{'provider_login_input'}) {
      croak("Missing the required parameter 'provider_login_input' when calling login_with_apple");
    }

    # parse inputs
    my $_resource_path = '/auth/apple';

    my $_method = 'POST';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    my $_header_accept = $self->{api_client}->select_header_accept('application/json');
    if ($_header_accept) {
        $header_params->{'Accept'} = $_header_accept;
    }
    $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');

lib/AgentPushKit/Client/AuthenticationApi.pm  view on Meta::CPAN

{
    my $params = {
    'provider_login_input' => {
        data_type => 'ProviderLoginInput',
        description => '',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'login_with_google' } = {
        summary => 'Log in or attach an account using a verified Google ID token',
        params => $params,
        returns => 'AuthResponse',
        };
}
# @return AuthResponse
#
sub login_with_google {
    my ($self, %args) = @_;

    # verify the required parameter 'provider_login_input' is set
    unless (exists $args{'provider_login_input'}) {
      croak("Missing the required parameter 'provider_login_input' when calling login_with_google");
    }

    # parse inputs
    my $_resource_path = '/auth/google';

    my $_method = 'POST';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    my $_header_accept = $self->{api_client}->select_header_accept('application/json');
    if ($_header_accept) {
        $header_params->{'Accept'} = $_header_accept;
    }
    $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');

    my $_body_data;
    # body params
    if ( exists $args{'provider_login_input'}) {
        $_body_data = $args{'provider_login_input'};
    }

    # authentication setting, if any
    my $auth_settings = [qw()];

    # make the API Call
    my $response = $self->{api_client}->call_api($_resource_path, $_method,
                                           $query_params, $form_params,
                                           $header_params, $_body_data, $auth_settings);
    if (!$response) {
        return;
    }
    my $_response_object = $self->{api_client}->deserialize('AuthResponse', $response);
    return $_response_object;
}

#
# login_with_password
#
# Log in with email and password
#
# @param PasswordLoginInput $password_login_input  (required)
{
    my $params = {
    'password_login_input' => {
        data_type => 'PasswordLoginInput',
        description => '',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'login_with_password' } = {
        summary => 'Log in with email and password',
        params => $params,
        returns => 'AuthResponse',
        };
}
# @return AuthResponse
#
sub login_with_password {
    my ($self, %args) = @_;

    # verify the required parameter 'password_login_input' is set
    unless (exists $args{'password_login_input'}) {
      croak("Missing the required parameter 'password_login_input' when calling login_with_password");
    }

    # parse inputs
    my $_resource_path = '/auth/login';

    my $_method = 'POST';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    my $_header_accept = $self->{api_client}->select_header_accept('application/json');
    if ($_header_accept) {
        $header_params->{'Accept'} = $_header_accept;
    }
    $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');

    my $_body_data;
    # body params
    if ( exists $args{'password_login_input'}) {
        $_body_data = $args{'password_login_input'};
    }

    # authentication setting, if any
    my $auth_settings = [qw()];

    # make the API Call
    my $response = $self->{api_client}->call_api($_resource_path, $_method,
                                           $query_params, $form_params,
                                           $header_params, $_body_data, $auth_settings);
    if (!$response) {
        return;
    }
    my $_response_object = $self->{api_client}->deserialize('AuthResponse', $response);
    return $_response_object;
}

#
# register
#
# Create a user and first customer account
#
# @param RegisterInput $register_input  (required)
{
    my $params = {
    'register_input' => {
        data_type => 'RegisterInput',
        description => '',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'register' } = {
        summary => 'Create a user and first customer account',
        params => $params,
        returns => 'AuthResponse',
        };
}
# @return AuthResponse
#
sub register {
    my ($self, %args) = @_;

    # verify the required parameter 'register_input' is set
    unless (exists $args{'register_input'}) {
      croak("Missing the required parameter 'register_input' when calling register");
    }

    # parse inputs
    my $_resource_path = '/auth/register';

    my $_method = 'POST';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    my $_header_accept = $self->{api_client}->select_header_accept('application/json');
    if ($_header_accept) {
        $header_params->{'Accept'} = $_header_accept;
    }
    $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');

    my $_body_data;
    # body params
    if ( exists $args{'register_input'}) {
        $_body_data = $args{'register_input'};
    }

    # authentication setting, if any
    my $auth_settings = [qw()];

    # make the API Call
    my $response = $self->{api_client}->call_api($_resource_path, $_method,
                                           $query_params, $form_params,
                                           $header_params, $_body_data, $auth_settings);
    if (!$response) {
        return;
    }
    my $_response_object = $self->{api_client}->deserialize('AuthResponse', $response);
    return $_response_object;
}

#
# request_password_reset
#
# Email a single-use password reset token
#
# @param PasswordResetRequestInput $password_reset_request_input  (required)
{
    my $params = {
    'password_reset_request_input' => {
        data_type => 'PasswordResetRequestInput',
        description => '',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'request_password_reset' } = {
        summary => 'Email a single-use password reset token',
        params => $params,
        returns => 'AcceptedResponse',
        };
}
# @return AcceptedResponse
#
sub request_password_reset {
    my ($self, %args) = @_;

    # verify the required parameter 'password_reset_request_input' is set
    unless (exists $args{'password_reset_request_input'}) {
      croak("Missing the required parameter 'password_reset_request_input' when calling request_password_reset");
    }

    # parse inputs
    my $_resource_path = '/auth/password-reset/request';

    my $_method = 'POST';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    my $_header_accept = $self->{api_client}->select_header_accept('application/json');
    if ($_header_accept) {
        $header_params->{'Accept'} = $_header_accept;
    }
    $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');

    my $_body_data;
    # body params
    if ( exists $args{'password_reset_request_input'}) {
        $_body_data = $args{'password_reset_request_input'};
    }

    # authentication setting, if any
    my $auth_settings = [qw()];

    # make the API Call
    my $response = $self->{api_client}->call_api($_resource_path, $_method,
                                           $query_params, $form_params,
                                           $header_params, $_body_data, $auth_settings);
    if (!$response) {
        return;
    }
    my $_response_object = $self->{api_client}->deserialize('AcceptedResponse', $response);
    return $_response_object;
}

1;



( run in 0.410 second using v1.01-cache-2.11-cpan-4ef0a570458 )