summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-09-19 12:45:53 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2023-09-25 09:43:37 +0200
commit627e787809c94e38b9f14f3b9d095187a5a8a849 (patch)
tree09fa3490543a9ee185628522d6cc8ac69f0144a7
parentd4c60c8a0c566cf9f605a3b3e431ea8b51d1d4c8 (diff)
Export Docs: Update bullets spacing
-rw-r--r--docs/src/api/functiondocs.md20
-rw-r--r--exports/exports.go13
2 files changed, 30 insertions, 3 deletions
diff --git a/docs/src/api/functiondocs.md b/docs/src/api/functiondocs.md
index a9ab894..36bf30b 100644
--- a/docs/src/api/functiondocs.md
+++ b/docs/src/api/functiondocs.md
@@ -126,6 +126,7 @@ This value should not be parsed or converted somehow by the client This
value is simply to pass back to the Go library This value has two purposes:
- Cancel a long running function
+
- Send a reply to a state transition (ASK_PROFILE and ASK_LOCATION)
Functions that take a cookie have it as the first argument
@@ -141,6 +142,7 @@ The data that is sent to the Go library is the second argument of this
function
- `c` is the Cookie
+
- `data` is the data to send, e.g. a profile ID
## CurrentServer
@@ -279,9 +281,13 @@ CookieReply
So a client would:
-- Parse the data to get the cookie and data - get the cookie, - get the
-profiles from the data - show it in the UI and then reply with CookieReply
-using the choice
+- Parse the data to get the cookie and data
+
+- get the cookie,
+
+- get the profiles from the data
+
+- show it in the UI and then reply with CookieReply using the choice
### ASK_LOCATION
@@ -303,8 +309,11 @@ CookieReply,
So a client would:
- Parse the data to get the cookie and data
+
- get the cookie,
+
- get the list of locations from the data
+
- show it in the UI and then reply with CookieReply using the choice
### OAUTH_STARTED
@@ -344,14 +353,18 @@ user agent in all HTTP requests
`cb` is the state callback. It takes three arguments: The old state, the new
state and the data for the state as JSON
+
- Note that the states are defined in client/fsm.go, e.g. NO_SERVER (in
Go: StateNoServer), ASK_PROFILE (in Go: StateAskProfile)
+
- This callback returns non-zero if the state transition is handled.
This is used to check if the client handles the needed transitions
debug, if non-zero, enables debugging mode for the library, this means:
+
- Log everything in debug mode, so you can get more detail of what is
going on
+
- Write the state graph to a file in the configDirectory. This can be used
to create a FSM png file with mermaid https://mermaid.js.org/
@@ -490,6 +503,7 @@ setter is the void function that sets tokens. It takes two arguments:
- The `server` for which to get the tokens for, marshalled as JSON and
defined in types/server/server.go `Current`
+
- The `tokens`, defined in types/server/server.go `Tokens` marshalled as
JSON
diff --git a/exports/exports.go b/exports/exports.go
index dcb7687..6d02e88 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -130,11 +130,15 @@ func getVPNState() (*client.Client, error) {
// `Version` is the version of the client. This version field is used for the user agent in all HTTP requests
//
// `cb` is the state callback. It takes three arguments: The old state, the new state and the data for the state as JSON
+//
// - Note that the states are defined in client/fsm.go, e.g. NO_SERVER (in Go: StateNoServer), ASK_PROFILE (in Go: StateAskProfile)
+//
// - This callback returns non-zero if the state transition is handled. This is used to check if the client handles the needed transitions
//
// debug, if non-zero, enables debugging mode for the library, this means:
+//
// - Log everything in debug mode, so you can get more detail of what is going on
+//
// - Write the state graph to a file in the configDirectory. This can be used to create a FSM png file with mermaid https://mermaid.js.org/
//
// After registering, the FSM is initialized and the state transition NO_SERVER should have been completed
@@ -363,8 +367,11 @@ func ServerList() (*C.char, *C.char) {
// So a client would:
//
// - Parse the data to get the cookie and data
+//
// - get the cookie,
+//
// - get the profiles from the data
+//
// - show it in the UI and then reply with CookieReply using the choice
//
// ### ASK_LOCATION
@@ -384,8 +391,11 @@ func ServerList() (*C.char, *C.char) {
// So a client would:
//
// - Parse the data to get the cookie and data
+//
// - get the cookie,
+//
// - get the list of locations from the data
+//
// - show it in the UI and then reply with CookieReply using the choice
//
// ### OAUTH_STARTED
@@ -691,6 +701,7 @@ func getCookie(c C.uintptr_t) (*cookie.Cookie, error) {
// setter is the void function that sets tokens. It takes two arguments:
//
// - The `server` for which to get the tokens for, marshalled as JSON and defined in types/server/server.go `Current`
+//
// - The `tokens`, defined in types/server/server.go `Tokens` marshalled as JSON
//
// It returns an error when the tokens cannot be set
@@ -759,6 +770,7 @@ func SetTokenHandler(getter C.TokenGetter, setter C.TokenSetter) *C.char {
// This value has two purposes:
//
// - Cancel a long running function
+//
// - Send a reply to a state transition (ASK_PROFILE and ASK_LOCATION)
//
// Functions that take a cookie have it as the first argument
@@ -774,6 +786,7 @@ func CookieNew() C.uintptr_t {
// The data that is sent to the Go library is the second argument of this function
//
// - `c` is the Cookie
+//
// - `data` is the data to send, e.g. a profile ID
//
//export CookieReply