Changeset 40557 in project


Ignore:
Timestamp:
09/14/21 12:12:34 (9 days ago)
Author:
svnwiki
Message:

Anonymous wiki edit for IP [82.181.134.218]: Replace gemini-client wiki with redirect to gemini

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/gemini-client

    r40517 r40557  
    1 [[tags: egg]]
    2 
    3 == gemini-client
    4 
    5 [[toc:]]
    6 
    7 === Introduction
    8 
    9 This egg provides a client library for the featherweight hypertext
    10 transfer protocol, [[https://gemini.circumlunar.space/|Gemini]].
    11 
    12 Features:
    13 
    14 * Interprets {{gemini://}} URLs using the {{uri-generic}} egg.
    15 * Handles Gemini's compulsory TLS encryption using the {{openssl}} egg.
    16 * Parses the response header into a Scheme record.
    17 * Provides a condition type for unsuccessful Gemini responses.
    18 
    19 Gemini's standard markup language, Gemtext, is not parsed by this egg.
    20 
    21 === Make a request
    22 
    23 <procedure>(gemini-get uri handle-response)</procedure>
    24 
    25 Make a TLS-encrypted connection to the Gemini server at the host and
    26 port of {{uri}} (the default port is 1965). Ask for {{uri}} and call
    27 the procedure {{handle-response}} with the response object as an
    28 argument.
    29 
    30 {{uri}} must be a {{gemini://}} URI. It can be either a string or a
    31 URI object from the {{uri-generic}} egg.
    32 
    33 === Response object
    34 
    35 <procedure>(gemini-response? object)</procedure>
    36 
    37 Return {{#t}} if {{object}} is a Gemini response object, {{#f}}
    38 otherwise.
    39 
    40 <procedure>(gemini-response-code response)</procedure>
    41 
    42 Return the two-digit code at the very beginning of a Gemini response
    43 as a integer.
    44 
    45 <procedure>(gemini-response-first-digit response)</procedure>
    46 <procedure>(gemini-response-second-digit response)</procedure>
    47 
    48 Return either digit of the code as an integer. The first digit
    49 indicates the response category, the second is a detail.
    50 
    51 <procedure>(gemini-response-success? response)</procedure>
    52 
    53 Return {{#t}} if this is a success response (code 2x), {{#f}}
    54 otherwise.
    55 
    56 <procedure>(gemini-response-redirect? response)</procedure>
    57 
    58 Return {{#t}} if this is a redirect response (code 3x), {{#f}}
    59 otherwise.
    60 
    61 <procedure>(gemini-response-meta response)</procedure>
    62 
    63 Return the "meta" text: the remainder of the first line of the
    64 response after the status code.
    65 
    66 <procedure>(gemini-response-port response)</procedure>
    67 
    68 Return a binary input port from which the response body can be read.
    69 The caller should not close the port.
    70 
    71 <procedure>(gemini-response-read-bytevector-all response)</procedure>
    72 <procedure>(gemini-response-read-string-all response)</procedure>
    73 
    74 Convenience procedures to read the entire response body and return it
    75 as as bytevector or a string, respectively.
    76 
    77 <procedure>(gemini-response-raise response)</procedure>
    78 
    79 Convenience procedure which raises an appropriate exception unless
    80 {{response}} is a success ({{2x}}) response. The exception raised
    81 satisfies {{gemini-error?}}, and calling {{gemini-error-response}} on
    82 it returns {{response}}. If {{response}} is a success response,
    83 {{gemini-response-raise}} returns {{#f}}.
    84 
    85 === Error object
    86 
    87 <procedure>(gemini-error? object)</procedure>
    88 
    89 Return {{#t}} if {{object}} is a Gemini error condition, {{#f}}
    90 otherwise.
    91 
    92 <procedure>(gemini-error-response gemini-error)</procedure>
    93 
    94 Return the Gemini response object (satisfies {{gemini-response?}})
    95 associated with the error, of {{#f}} if none.
    96 
    97 === Example
    98 
    99   (display (gemini-get
    100             "gemini://gemini.circumlunar.space/capcom/"
    101             (lambda (response)
    102               (or (gemini-response-raise response)
    103                   (gemini-response-read-string-all response)))))
    104 
    105 === Version History
    106 
    107 * 0.1: First release.
    108 
    109 === Author
    110 
    111 Lassi Kortela
    112 
    113 === Repository
    114 
    115 [[https://github.com/lassik/scheme-gemini-client|
    116 https://github.com/lassik/scheme-gemini-client]]
    117 
    118 === License
    119 
    120   Copyright 2021 Lassi Kortela
    121 
    122   Permission to use, copy, modify, and distribute this software for any
    123   purpose with or without fee is hereby granted, provided that the above
    124   copyright notice and this permission notice appear in all copies.
    125 
    126   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
    127   WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
    128   WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
    129   AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
    130   DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
    131   PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
    132   TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    133   PERFORMANCE OF THIS SOFTWARE.
     1See [[gemini]]
Note: See TracChangeset for help on using the changeset viewer.