head	1.3;
access;
symbols
	tcllib-1-13:1.3
	tcllib-1-12:1.2;
locks; strict;
comment	@# @;


1.3
date	2010.11.29.17.16.25;	author afaupell;	state Exp;
branches;
next	1.2;

1.2
date	2009.02.25.17.08.50;	author afaupell;	state Exp;
branches;
next	1.1;

1.1
date	2009.02.05.03.27.53;	author afaupell;	state Exp;
branches;
next	;


desc
@@


1.3
log
@fix incorrect syntax in some url parameters
@
text
@# documentation: http://delicious.com/help/api

package require rest

set delicious(updated) {
    url https://api.del.icio.us/v1/posts/update
    auth basic
    result raw
    post_transform {
        regexp {<update time=\"(.*?)\"} $result -> update
        return [clock scan [string map {T " " Z " UTC"} $update]]
    }
}

set delicious(add_post) {
    url https://api.del.icio.us/v1/posts/add
    auth basic
    req_args { url: description: }
    opt_args { extended: tags: dt: replace: shared: }
    check_result { {[regexp {<result code=\"done} $result]} {} }
}

set delicious(delete_post) {
    url https://api.del.icio.us/v1/posts/delete
    auth basic
    req_args { url: }
    check_result { {[regexp {<result code=\"done} $result]} {} }
}

set delicious(get_posts) {
    url https://api.del.icio.us/v1/posts/get
    auth basic
    opt_args { url: tag: dt: hashes: meta: }
}

set delicious(recent_posts) {
    url https://api.del.icio.us/v1/posts/recent
    auth basic
    opt_args { tag: }
}

set delicious(post_dates) {
    url https://api.del.icio.us/v1/posts/dates
    auth basic
    opt_args { tag: count: }
}

set delicious(get_all_posts) {
    url https://api.del.icio.us/v1/posts/all
    auth basic
    opt_args { tag: start: results: fromdt: todt: meta: }
}

set delicious(get_hashes) {
    url https://api.del.icio.us/v1/posts/all
    auth basic
    static_args { hashes {} }
}

set delicious(get_tags) {
    url https://api.del.icio.us/v1/tags/get
    auth basic
}

set delicious(delete_tag) {
    url https://api.del.icio.us/v1/tags/delete
    auth basic
    req_args { tag: }
    check_result { {[regexp {<result>done} $result]} {} }
}

set delicious(rename_tag) {
    url https://api.del.icio.us/v1/tags/rename
    auth basic
    req_args { old: new: }
    check_result { {[regexp {<result>done} $result]} {} }
}

set delicious(get_bundles) {
    url https://api.del.icio.us/v1/bundles/all
    auth basic
    opt_args { bundle: }
}

set delicious(set_bundle) {
    url https://api.del.icio.us/v1/bundles/set
    auth basic
    req_args { bundle: tags: }
    check_result { {[regexp {<result>ok} $result]} {} }
}

set delicious(delete_bundle) {
    url https://api.del.icio.us/v1/bundles/delete
    auth basic
    req_args { bundle: }
    check_result { {[regexp {<result>done} $result]} {} }
}

set delicious(public_posts) {
    url http://feeds.delicious.com/v2/json/%user%/%tags:%
    opt_args { count: }
}

set delicious(modify_post) {
    url https://api.del.icio.us/v1/posts/add
    auth basic
    req_args { post: }
    opt_args { description: extended: tags: dt: shared: }
    check_result { {[regexp {<result code=\"done} $result]} {} }
    result raw
    input_transform {
        set new [dict remove [dict get $query post] hash others meta]
        foreach {from to} {href url tag tags time dt} {
             set v [dict get $new $from]
             set new [dict remove $new $from]
             dict set new $to $v
        }
        dict for {k v} [dict remove $query post] {
            if {$v == ""} {
                set new [dict remove $new $k]
                continue
            }
            if {$k == "dt"} { set v [string trimright $v Z] }

            set new [dict replace $new $k $v]
        }
        return $new
    }
}

rest::create_interface delicious
@


1.2
log
@add documentation links for twitter, delicious, yboss. fix metadata in man page
@
text
@d24 1
a24 1
    url { https://api.del.icio.us/v1/posts/delete }
d31 1
a31 1
    url { https://api.del.icio.us/v1/posts/get }
d37 1
a37 1
    url { https://api.del.icio.us/v1/posts/recent }
d43 1
a43 1
    url { https://api.del.icio.us/v1/posts/dates }
d49 1
a49 1
    url { https://api.del.icio.us/v1/posts/all }
d55 1
a55 1
    url { https://api.del.icio.us/v1/posts/all }
d61 1
a61 1
    url { https://api.del.icio.us/v1/tags/get }
d66 1
a66 1
    url { https://api.del.icio.us/v1/tags/delete }
d73 1
a73 1
    url { https://api.del.icio.us/v1/tags/rename }
d80 1
a80 1
    url { https://api.del.icio.us/v1/bundles/all }
d86 1
a86 1
    url { https://api.del.icio.us/v1/bundles/set }
d93 1
a93 1
    url { https://api.del.icio.us/v1/bundles/delete }
@


1.1
log
@initial commit
@
text
@d1 2
@

