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

optional path params #108

Merged
merged 2 commits into from
Oct 24, 2019
Merged

Conversation

dbushong
Copy link
Member

@dbushong dbushong commented Oct 23, 2019

one might wish to write a client like this:

class Foo extends Gofer {
  constructor(cfg) {
    super(cfg, 'foo');
  }

  bar({ x, y }) {
    return this.get('/{x}/{y}', {
      endpointName: 'bar',
      pathParams: { x, y },
    });
  }
}

const foo = new Foo({ foo: { pathParams: { x: 'whee' } } });
await foo.bar({ y: 'yay' });

with the current types, it will complain that you're passing an
undefined value as a pathParam, but really that will be dealt with in
the config merging later on, so we should accept it


This PR was started by: git wf pr

one might wish to write a client like this:

```js
class Foo extends Gofer {
  constructor(cfg) {
    super(cfg, 'foo');
  }

  bar({ x, y }) {
    return this.get('/{x}/{y}', {
      endpointName: 'bar',
      pathParams: { x, y },
    });
  }
}

const foo = new Foo({ foo: { pathParams: { x: 'whee' } } });
await foo.bar({ y: 'yay' });
```

with the current types, it will complain that you're passing an
undefined value as a pathParam, but really that will be dealt with in
the config merging later on, so we should accept it
Copy link
Member

@aotarola aotarola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💚

@dbushong dbushong merged commit 8391ee7 into master Oct 24, 2019
@dbushong dbushong deleted the dbushong/feature/master/optional-path-params branch October 24, 2019 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants