add more examples to readme
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/CHANGELOG.md
diff --git a/README.md b/README.md
index 7319dd9..71ecb95 100644
--- a/README.md
+++ b/README.md
@@ -129,7 +129,7 @@ Add the supervisor to your supervision tree:
end
```
-# SHOW HOW TO ADD ANOTHER CLIENT HERE .... LATER.....
+## SHOW HOW TO ADD ANOTHER CLIENT HERE LATER.....
## Example Usage(s)
@@ -138,7 +138,6 @@ Add the supervisor to your supervision tree:
### Example 1:
-
Get account details and containers for given account
```elixir
alias ExOvh.Query.Openstack.Swift, as: Query
@@ -167,9 +166,41 @@ Get the count of containers again
```
+### Example 2:
+
+Adding an object to the "default" container in OVH Webstorage
+
+ import ExOvh.Query.Openstack.Swift
+ alias ExOvh.Ovh.OpenstackApi.Webstorage.Cache, as: OpenCache
+ client = ExOvh
+ service = "cdnwebstorage-<your_service_name>"
+ account = OpenCache.get_account(client, service)
+
+ object_name = "client_file.txt"
+ client_object = Kernel.to_string(:code.priv_dir(:ex_ovh)) <> "/" <> object_name
+ container = "default"
+ server_object = String.replace(object_name, "client", "server")
+ create_file_request = create_object(account, container, client_object, server_object)
+
+ ExOvh.ovh_request(create_file_request, %{ openstack: :true, webstorage: service })
-# TO BE CONTINUED..... LATER ....
+# Listing all objects for "default" container to see if the new `server_object` is there.
+
+ import ExOvh.Query.Openstack.Swift
+ alias ExOvh.Ovh.OpenstackApi.Webstorage.Cache, as: OpenCache
+ client = ExOvh
+ service = "cdnwebstorage-<your_service_name>"
+ account = OpenCache.get_account(client, service)
+ request = get_objects(account, "default")
+
+ {:ok, resp} = ExOvh.ovh_request(request, %{ openstack: :true, webstorage: service })
+ objects = Enum.map(resp.body, &(Map.get(&1, "name")))
+
+ Enum.member?(objects, server_object)
+
+
+## Add more examples ....