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

Add reference object to Response #40

Closed
christopheranderson opened this issue Jul 10, 2018 · 2 comments
Closed

Add reference object to Response #40

christopheranderson opened this issue Jul 10, 2018 · 2 comments
Assignees
Labels
breaking non-additive functional behavior changes feature Adds or changes functional behavior
Projects
Milestone

Comments

@christopheranderson
Copy link
Contributor

Problem:
.get is confusing, but we need a way to get a reference to a given resource. We decided on a combo approach of renaming .get and adding the reference to the response of async calls.
From #39:

  1. Return reference object in response from async operations.
    - Example: const { resource: db} = client.databases.create({id: foo});
    - Pros: Helps reduce number of lines of code for many scenarios (like db and container create)
    - Cons: Doesn't remove need for .get because we don't want to force an async operation just to get a reference. Won't work with Steve's idea for simplifying the response types.

Additionally, we'll rename result to body to

Implementation details:

interface CosmosResponse<T, U> {
    body: T;
    headers: Headers;
    ref: U;
}

interface DatabaseResponse extends CosmosResponse<DatabaseDefinition, Database> {
    body: DatabaseDefinition;
    headers: Headers;
    ref: Database;
    database: Database;
}

/* Similar pattern for other types */
@christopheranderson christopheranderson added feature Adds or changes functional behavior breaking non-additive functional behavior changes labels Jul 10, 2018
@christopheranderson christopheranderson self-assigned this Jul 10, 2018
@christopheranderson christopheranderson added this to New/Ready in Kanban via automation Jul 10, 2018
@christopheranderson christopheranderson moved this from New/Ready to In Progress in Kanban Jul 10, 2018
@christopheranderson
Copy link
Contributor Author

Question: What should be done about QueryIterator?

southpolesteve added a commit to christopheranderson/azure-cosmos-js that referenced this issue Jul 11, 2018
@christopheranderson christopheranderson added this to the Preview milestone Jul 13, 2018
This was referenced Jul 14, 2018
christopheranderson pushed a commit that referenced this issue Jul 16, 2018
* Update User

* Add UserResponse to user module exports

* Update Permissiono

* Update Stored Procedure

* Update Trigger

* Update UserDefinedFunction

* Update offer

* Update tests with new response type

* Update readme

* Prettier updates

* More prettier updates

* tslint issues

* Update Conflict

* tslint issues

* Fix missing TestHelper implementations
@christopheranderson
Copy link
Contributor Author

Closed in #52

Kanban automation moved this from In Progress to Done Jul 20, 2018
christopheranderson pushed a commit that referenced this issue Jul 24, 2018
* Update User

* Add UserResponse to user module exports

* Update Permissiono

* Update Stored Procedure

* Update Trigger

* Update UserDefinedFunction

* Update offer

* Update tests with new response type

* Update readme

* Prettier updates

* More prettier updates

* tslint issues

* Update Conflict

* tslint issues

* Fix missing TestHelper implementations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking non-additive functional behavior changes feature Adds or changes functional behavior
Projects
No open projects
Kanban
  
Done
Development

No branches or pull requests

1 participant