Skip to content

Commit

Permalink
added types to supported functions
Browse files Browse the repository at this point in the history
  • Loading branch information
cecoeco committed Aug 23, 2024
1 parent ef64e81 commit 1a36903
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ Pkg.add(url = "https://github.com/TidierOrg/HTTR.jl.git")

HTTR.jl currently supports:

| **Category** | **Function** |
| **Category** | **Function/Type** |
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Create and Modify Requests** | `request()`, `req_body_raw()`, `req_body_file()`, `req_body_json()`, `req_headers()`,`req_method()`, `req_progress()`,`req_timeout()`, `req_url()`, `req_user_agent()` |
| **Create and Modify Requests** | `request()`, `Request`, `req_body_raw()`, `req_body_file()`, `req_body_json()`, `req_headers()`,`req_method()`, `req_progress()`,`req_timeout()`, `req_url()`, `req_user_agent()` |
| **Debugging and Testing Requests** | `last_response()`, `last_request()`, `req_verbose()`, `with_verbosity()` |
| **Requests Authentication** | `req_auth_basic()`, `req_auth_bearer_token()` |
| **Perform a Request** | `req_perform()`, `req_retry()` |
| **Perform Multiple Requests** | _(No functions included)_ |
| **Handle the Response** | `resp_body_raw()`, `resp_has_body()`, `resp_body_string()`, `resp_body_json()`,`resp_body_html()`, `resp_body_xml()`, `resp_check_content_type()`, `resp_content_type()`, `resp_encoding()`, `resp_date()`, `resp_headers()`, `resp_header()`, `resp_header_exists()`, `resp_link_url()`, `resp_raw()`, `resp_retry_after()`, `resp_status()`, `resp_status_desc()`, `resp_is_error()`,`resp_check_status()`, `resp_url()`, `resp_url_path()`, `resp_url_query()`, `resp_url_queries()` |
| **Miscellaneous Helpers** | `curl_help()`, `secret_make_key()`, `secret_has_key()`, `url_parse()`, `url_build()` |
| **OAuth** | `oauth_cache_path()`, `oauth_client()`, `oauth_redirect_uri()`, `oauth_token()` |
| **OAuth** | `oauth_cache_path()`, `OAuthClient`, `oauth_client()`, `oauth_redirect_uri()`, `OAuthToken`, `oauth_token()` |

## Examples

Creating and modifying the request:

**`HTTR.Request`** is the equivalent to R's `httr2_request` request S3 class. Several functions can be used to modify this request. These functions can modify the request's methods, body, headers, etc.
**`HTTR.Request`** is the equivalent to R's `httr2_request` S3 class. Several functions can be used to modify the request returned by this request. These functions can modify the request's methods, body, headers, etc.

The **`request()`** function creates the **`HTTR.Request`** type. Without a body the request method defaults to GET. Using the `@chain` macro a request can be performed then the response can be then read as a `String` using the **`resp_body_string`** function. If no response function is used the request will return the response as the type [`HTTP.Messages.Response`](https://juliaweb.github.io/HTTP.jl/stable/reference/#HTTP.Messages.Response) from the `HTTP.jl` package:
The **`HTTR.request()`** function creates the **`HTTR.Request`** type. Without a body the request method defaults to GET. By using the **`@chain`** macro, a request can be performed then the response can be then read as a **`String`** using the **`resp_body_string()`** function. If no response function is used the request will return the response as the type [**`HTTP.Messages.Response`**](https://juliaweb.github.io/HTTP.jl/stable/reference/#HTTP.Messages.Response) from the `HTTP.jl` package:

```julia
using HTTR, Chain
Expand All @@ -51,7 +51,7 @@ using HTTR, Chain
end
```

To create a POST request add a request body to the request, one way to do this is using the **`req_body_json()`** function and adding the content type of `application/json`, so that the request can be recognized as json. The response can be then read as a json using the **`resp_body_json`** function:
To create a POST request add a request body to the request, one way to do this is using the **`req_body_json()`** function and adding the content type of `application/json`, so that the request can be recognized as json. The response can be then read as a json using the **`resp_body_json()`** function:

```julia
using HTTR, Chain
Expand Down

0 comments on commit 1a36903

Please sign in to comment.