From 8905a5264dad46156071f5be992761ca17d33d76 Mon Sep 17 00:00:00 2001 From: Elis Axelsson Date: Sat, 29 Apr 2017 12:42:46 +0200 Subject: [PATCH] Re-arrange arguments to webpaste-provider and update docs --- webpaste.el | 50 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/webpaste.el b/webpaste.el index 3d5239b..70320f5 100644 --- a/webpaste.el +++ b/webpaste.el @@ -102,38 +102,48 @@ each run.") (cl-defun webpaste-provider (&key uri + post-field + success-lambda (type "POST") - (parser 'buffer-string) (post-data '()) - (sync nil) - post-field - (post-field-lambda webpaste/providers-default-post-field-lambda) + (parser 'buffer-string) (error-lambda webpaste/providers-error-lambda) - success-lambda) + (post-field-lambda webpaste/providers-default-post-field-lambda) + (sync nil)) "Function to create the lambda function for a provider. Usage: (webpaste-provider [:keyword [option]]...) -:uri URI that we should do the request to to paste data. -:type HTTP Request type, defaults to POST. -:parser Defines how request.el parses the result. Look up :parser for - `request'. This defaults to 'buffer-string. -:post-data Default post fields sent to service. Defaults to nil. -:post-field Name of the field to insert the code into. -:sync Set to t to wait until request is done. Defaults to nil. This - should only be used for debugging purposes. +Required params: +:uri URI that we should do the request to to paste data. + +:post-field Name of the field to insert the code into. + +:success-lambda Callback sent to `request', look up how to write these in the + documentation for `request'. + +Optional params: +:type HTTP Request type, defaults to POST. + +:post-data Default post fields sent to service. Defaults to nil. + +:parser Defines how request.el parses the result. Look up :parser for + `request'. This defaults to 'buffer-string. + +:error-lambda Callback sent to `request', look up how to write these in the + documentation for `request'. The default value for this is + `webpaste/providers-error-lambda', but there's also + `webpaste/providers-error-lambda-no-failover' available if + you need a provider that isn't allowed to failover. + :post-field-lambda Function that builds and returns the post data that should be sent to the provider. It should accept the parameter TEXT only which contains the content that should be sent. -:success-lambda Callback sent to `request', look up how to write these in the - documentation for `request'. -:error-lambda Callback sent to `request', look up how to write these in the - documentation for `request'. The default value for this is - `webpaste/providers-error-lambda', but there's also - `webpaste/providers-error-lambda-no-failover' available if you - need a provider that isn't allowed to failover." + +:sync Set to t to wait until request is done. Defaults to nil. + This should only be used for debugging purposes." (lambda (text) "Paste TEXT to provider"