The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

AnyEvent::HTTP::Spark - HTTP Rest Client for Cisco Spark

SYNOPSIS

use AnyEvent::HTTP::Spark;

my $obj=new AnyEvent::HTTP::Spark(token=>$ENV{SPARK_TOKEN});

DESCRIPTION

THe HTTP Rest client used to interact with the Cisco Spark Web Service.

Moo Roles Used

This class uses the following Moo Roles

HTTP::MultiGet::Role
Log::LogMethods
Data::Result::Moo
AnyEvent::SpakBot::SharedRole

OO Arguments and accessors

Required OO Arguments

token: required for spark authentication

Optional OO Arguments

logger: sets the logging object
agent: AnyEvent::HTTP::MultiGet object
api_url: https://api.ciscospark.com/v1/
  # sets the web service the requests point to

OO Methods

  • my $id=$self->que_listPeople($cb,$args);

    Ques a request to list people.

    $args is assumed to be a hash ref

    Default arguments maxResults: 100, sets the number of results

    Search arguments ( use one set )

    Email Search email: Someoen@somewhere.com

    Display Name Search

    displayName: firstname lastname

    In theory you can paginate with this api call, although there is no documentation from cisco to validate this.

  • my $id=$self->que_createPerson($cb,$data);

    Que's the creation of a person

    $data is expected to be an anonymous hash ref

    emails:  string[]	
    displayName:  string	
    firstName:  string	
    lastName:  string	
    avatar:  string	
    orgId:  string	
    roles:  string[]	
    licenses:  string[]
  • my $id=$self->que_getPerson($cb,$personId);

    Que's up a personId lookup.

  • my $id=$self->que_getMe()

    Que's a request to identify this current user.

  • my $id=$self->que_getMessage($cb,$messageId)

    Que's a request for a given messageId

  • my $id=$self->que_createMessage($cb,$data)

    Creates a message

    $data is assumed to be an anonymous hash ref

    keys/Values:

    roomId:	string	
    toPersonId:    string	
    toPersonEmail: string	
    text:          string	
    markdown:      string	
    files:         string[] 

Low Level Request functions

This section documents low level request functions.

  • my $result=$self->build_post_json($url,$data);

    Returns a Data::Result object; When true it contains an HTTP::Request Object For $url, the body will consist of $data converted to json. When false it contains why it failed.

  • my $id=$self->queue_builder($cb,$method,$url,$data);

    Returns the ID of the object in the request for $method.

  • my $id=$self->que_post_json($cb,$url,$data);

    Queue's a json post and returns the id

  • my $result=$self->build_put_json($url,$data);

    Returns a Data::Result object; When true it contains an HTTP::Request Object For $url, the body will consist of $data converted to json. When false it contains why it failed.

  • my $id=$self->que_put_json($cb,$url,$data);

    Queue's a json put and returns the id

  • my $result=$self->build_post_form($url,$data);

    Returns a Data::Result Object, when true it contains the correctly fromatted HTTP::Request Object, when false it contains why it failed.

  • my $id=$self->que_post_form($cb,$url,$data);

    Queue's a form post and returns the id

  • my $result=$self->build_get($url,$data);

    Returns a Data::Result Object, when true it contains the correctly fromatted HTTP::Request Object, when false it contains why it failed.

  • my $self->que_getRaw($cb,$raw_url)

    Que's a diy get request

  • my $id=$self->que_get($cb,$url,$data);

    Queue's a form post and returns the id

  • my $result=$self->build_head($url,$data);

    Returns a Data::Result Object, when true it contains the correctly fromatted HTTP::Request Object, when false it contains why it failed.

  • my $id=$self->que_head($cb,$url,$data);

    Queue's a form post and returns the id

  • my $result=$self->build_delete($url,$data);

    Returns a Data::Result Object, when true it contains the delete request, when false it contains why it failed.

  • my $id=$self->que_delete($cb,$url,$data);

    Ques a delete to run.

  • $self->handle_delete($cb,$id,$result,$result)

    Internal handler for delete results

AUTHOR

Michael Shipper <AKALINUX@CPAN.ORG>

1 POD Error

The following errors were encountered while parsing the POD:

Around line 147:

Expected '=item *'