Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement create/update and list Workers endpoints #106

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ispivey
Copy link
Contributor

@ispivey ispivey commented Feb 9, 2020

This builds on changes in #105 to implement the simple version of the create/update Worker endpoint, as well as implementing the list Workers endpoint, as described in #104 . Up next can be the multi-part-form create/update method!

... I'm not sure the best way to stage my PRs so that this one clearly depends on my previous one, since I realize each PR should correspond to a single issue. I'd appreciate some guidance :)

To validate this all works as intended:

➜  cloudflare-rs git:(ispivey/workers-list-and-create-scripts) cd cloudflare-examples
➜  cloudflare-examples git:(ispivey/workers-list-and-create-scripts) cargo run -- --auth-token=$CF_AUTH_TOKEN create_script $CF_ACCOUNT_ID bleepbloop | jq
    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
...
{
  "id": "bleepbloop",
  "etag": "005603661bf9ed84cb3569a53f7caf7c3377e726b37e6064001afb2462ae9845",
  "script": "addEventListener('fetch', event => { event.respondWith(fetch(event.request)) })",
  "size": 127,
  "created_on": "0001-01-01T00:00:00Z",
  "modified_on": "2020-02-09T18:26:34.653254Z"
}
➜  cloudflare-examples git:(ispivey/workers-list-and-create-scripts) cargo run -- --auth-token=$CF_AUTH_TOKEN list_scripts $CF_ACCOUNT_ID | jq
   Compiling cloudflare v0.6.3 (/Users/ispivey/src/cloudflare-rs/cloudflare)
   Compiling cloudflare-examples v0.5.0 (/Users/ispivey/src/cloudflare-rs/cloudflare-examples)
    Finished dev [unoptimized + debuginfo] target(s) in 7.80s
...
[
  {
    "id": "bleepbloop",
    "etag": "005603661bf9ed84cb3569a53f7caf7c3377e726b37e6064001afb2462ae9845",
    "script": null,
    "size": null,
    "created_on": "2020-02-09T02:29:07.292152Z",
    "modified_on": "2020-02-09T17:30:24.938709Z"
  },
...
]
➜  cloudflare-examples git:(ispivey/workers-list-and-create-scripts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant