Code Monkey home page Code Monkey logo

Comments (4)

elithrar avatar elithrar commented on May 12, 2024 1

Q: What benefit does passing Zone as the function argument give (today, and in the future) if we require the user to do the name => ID lookup prior?

I 100% agree that rationalizing the function signatures is useful, and would be OK with a functions accepting a zoneID string instead of a zoneName string.

We can provide a helper function around the APIโ€”ZoneByName(zoneName string) (string, error) via GET /zone?name=$nameโ€”that returns the zoneID for the package user to cache locally and then pass to functions as needed. The package user can async that as needed (via a waitgroup or channels) if they have a bunch of zones to lookup.

from cloudflare-go.

jamesog avatar jamesog commented on May 12, 2024

Initially I wanted as little friction as possible for users of the library/API so thought it made more sense, in most cases, to pass in the zone name and have the function do the zone ID lookup for you. There were one or two cases where it seemed to make more sense to use the object instead.

I do agree that this needs cleaning up and made more consistent.

from cloudflare-go.

Tenzer avatar Tenzer commented on May 12, 2024

Accepting Zone instead of a zone ID would mean we could check if the plan of a zone allow an action to be made, without firing a request to the API. That's the only thing I could think of from the top of my head, and may not be enough reason to require users to use Zone everywhere.
I think accepting the zone ID as a string would be the best option then.

from cloudflare-go.

Tenzer avatar Tenzer commented on May 12, 2024

This was done in #22.

from cloudflare-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.