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

WebService::Pixela::Webhook - It's Pixela Webhook API client

SYNOPSIS

    use strict;
    use warnings;
    use utf8;

    use WebService::Pixela;

    # All WebService::Pixela methods use this token and user name in URI, JSON, etc.
    my $pixela = WebService::Pixela->new(token => "thisissecret", username => "testname");

    # setting graph id
    $pixela->graph->id('graph_id');

    $pixela->webhook->create(type => 'increment');

    print $pixela->webhook->hash() ."\n"; # dump webhookHash

    $pixela->webhook->invoke();

    $pixela->webhook->delete();

DESCRIPTION

WebService::Pixela::Webhook is user API client about Pixe.la webservice.

INTERFACE

instance methods

This instance method require WebService::Pixela instance. So, Usually use these methods from the WebService::Pixela instance.

$pixela->webhook->create(%opts)

Create a new Webhook by Pixe.la This method return webhookHash, this is automatically set instance.

%opts might be:

[required] graph_id : Str

Specify the target graph as an ID. If the graph id is set for an instance, it will be automatically used. (You do not need to enter it as an argument)

[required] type : [increment|decrement]

Specify the behavior when this Webhook is invoked. Only increment or decrement are supported. (There is no distinction between upper case and lower case letters.)

See also

https://docs.pixe.la/#/post-webhook

$pixela->webhook->hash($webhookhash)

This is webhookHash. Used by Pixela's webhook service.

$webhookhash might be:

$webhookhash :Str

It is a new webhookHash. If the graph id is set for an instance, it will be automatically used create method.

$pixela->webhook->get()

Get all predefined webhooks definitions. This method return array_ref or json value(switching decode method).

See also

https://docs.pixe.la/#/get-webhook

$pixela->webhook->invoke($webhookhash)

Invoke the webhook registered in advance. It is used “timezone” setting as post date if Graph’s “timezone” is specified, if not specified, calculates it in “UTC”.

$webhookhash might be:

$webhookhash :Str

If the webhookhash is using thid method , it will be automatically used. (You do not need to enter it as an argument)

See also

https://docs.pixe.la/#/invoke-webhook

$pixela->webhook->delete($webhookhash)

Delete the registered Webhook.

$webhookhash might be:

$webhookhash :Str

If the webhookhash is using thid method , it will be automatically used. (You do not need to enter it as an argument)

See also

https://docs.pixe.la/#/delete-webhook

LICENSE

Copyright (C) Takahiro SHIMIZU.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Takahiro SHIMIZU <anatofuz@gmail.com>