diff --git a/_includes/js-toc.html b/_includes/js-toc.html index 8fe6f34..53dd648 100644 --- a/_includes/js-toc.html +++ b/_includes/js-toc.html @@ -24,4 +24,5 @@ * [Authentication]({{ site.github.url }}/js/authentication) * [State Syncing]({{ site.github.url }}/js/state-syncing) * [Data Down, Actions Up]({{ site.github.url }}/js/ddau) +* [Extra params]({{ site.github.url }}/js/extra-params) diff --git a/_site/feed.xml b/_site/feed.xml index defbfd3..4e5e68a 100644 --- a/_site/feed.xml +++ b/_site/feed.xml @@ -1,5 +1,5 @@ -Jekyll2025-03-18T13:37:10-05:00/feed.xmlGraphitiStylish Graph APIs -Tutorial Write-Ups Are Out!2019-10-14T00:00:00-05:002019-10-14T00:00:00-05:00/2019/10/14/tutorialThough we’ve long had a sample application with step-by-step diffs, we’ve been missing a full walkthrough. That now exists! Start with Step 0: Bootstrapping.

+Jekyll2023-05-23T02:06:24-04:00/feed.xmlGraphitiStylish Graph APIs +Tutorial Write-Ups Are Out!2019-10-14T00:00:00-04:002019-10-14T00:00:00-04:00/2019/10/14/tutorial<p>Though we’ve long had a <a href="https://github.com/graphiti-api/employee_directory">sample application</a> with step-by-step diffs, we’ve been missing a full walkthrough. That now exists! Start with <a href="https://www.graphiti.dev/tutorial/step_0">Step 0: Bootstrapping</a>.</p>

These write-ups will tell you the relevant code and commands, but they’ll also give helpful context around the decisions Graphiti makes. diff --git a/_site/js/authentication.html b/_site/js/authentication.html index 91a84fb..255c14a 100644 --- a/_site/js/authentication.html +++ b/_site/js/authentication.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/ddau.html b/_site/js/ddau.html index 39647d1..f6d1b01 100644 --- a/_site/js/ddau.html +++ b/_site/js/ddau.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/extra-params.html b/_site/js/extra-params.html new file mode 100644 index 0000000..7e73688 --- /dev/null +++ b/_site/js/extra-params.html @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + Graphiti + + + + + + + + + + + + + + + + + + +
    +
    + + +
    +

    + Spraypaint + the isomorphic, framework-agnostic Graphiti ORM +

    + + + +
    +

    Extra Params

    + +

    Sometimes you need to submit params that are not standard jsonapi params. One great example would be +https://yourdomain.com/users?debug=true which is not a param for the UserResource you may have, but +might enable functionality in your controller as needed.

    + +

    Invoking it is pretty straightforward, just invoke extraParams and pass in params and values you wish +to add to your API call when executed.

    + +
    YourRecord.extraParams({ debug: true })
    + +

    One common way to use this globally is to put this into a base class so it can be chained as part of +every resource.

    + +
    +
    + Typescript +
    +
    + Javascript +
    +
    + +
    + +
      @Model
    +  export class ApplicationRecord extends SpraypaintBase {
    +    static withDebug<T extends ApplicationRecord>(): Scope<T> {
    +      return this.extraParams({ debug: true }) as Scope<T>;
    +    }
    +  }
    +  // unfortunately you will need to pass in the 
    +  // implementing class' type as a generic
    +  UserRecord.withDebug<UserRecord>().all()
    +  
    + +
      const ApplicationRecord = SpraypaintBase.extend({
    +    static: {
    +      withDebug: () => this.extraParams({ debug: true });
    +    }
    +  })
    +  UserRecord.withDebug().all()
    +  
    + +
    +
    + +
    +
    +
    + + + + + + diff --git a/_site/js/index.html b/_site/js/index.html index 5a1678a..c96bf2e 100644 --- a/_site/js/index.html +++ b/_site/js/index.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/installation.html b/_site/js/installation.html index c0d93ec..f4081ab 100644 --- a/_site/js/installation.html +++ b/_site/js/installation.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/introduction.html b/_site/js/introduction.html index cbe322b..95ed3cc 100644 --- a/_site/js/introduction.html +++ b/_site/js/introduction.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/middleware.html b/_site/js/middleware.html index aac9534..ca7eeca 100644 --- a/_site/js/middleware.html +++ b/_site/js/middleware.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/reads/fieldsets.html b/_site/js/reads/fieldsets.html index 232bc5b..697e8d3 100644 --- a/_site/js/reads/fieldsets.html +++ b/_site/js/reads/fieldsets.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/reads/filtering.html b/_site/js/reads/filtering.html index d781701..a02b230 100644 --- a/_site/js/reads/filtering.html +++ b/_site/js/reads/filtering.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/reads/includes.html b/_site/js/reads/includes.html index 4968f4b..2ccb163 100644 --- a/_site/js/reads/includes.html +++ b/_site/js/reads/includes.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/reads/index.html b/_site/js/reads/index.html index bdcb60b..b4dc32b 100644 --- a/_site/js/reads/index.html +++ b/_site/js/reads/index.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/reads/nested-queries.html b/_site/js/reads/nested-queries.html index 13fc2d6..6bd23a9 100644 --- a/_site/js/reads/nested-queries.html +++ b/_site/js/reads/nested-queries.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/reads/pagination.html b/_site/js/reads/pagination.html index 5334fca..3838bcf 100644 --- a/_site/js/reads/pagination.html +++ b/_site/js/reads/pagination.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/reads/sorting.html b/_site/js/reads/sorting.html index de3d350..c03f10d 100644 --- a/_site/js/reads/sorting.html +++ b/_site/js/reads/sorting.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/reads/statistics.html b/_site/js/reads/statistics.html index fdb364d..60adaea 100644 --- a/_site/js/reads/statistics.html +++ b/_site/js/reads/statistics.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/state-syncing.html b/_site/js/state-syncing.html index bbeb7ee..2774c77 100644 --- a/_site/js/state-syncing.html +++ b/_site/js/state-syncing.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/writes/deferred.html b/_site/js/writes/deferred.html index 02bd115..26e6c16 100644 --- a/_site/js/writes/deferred.html +++ b/_site/js/writes/deferred.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/writes/dirty-tracking.html b/_site/js/writes/dirty-tracking.html index 8aa8048..71c6937 100644 --- a/_site/js/writes/dirty-tracking.html +++ b/_site/js/writes/dirty-tracking.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/writes/index.html b/_site/js/writes/index.html index 68ef3bd..8027e4c 100644 --- a/_site/js/writes/index.html +++ b/_site/js/writes/index.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/writes/nested.html b/_site/js/writes/nested.html index 9638475..d1cb40a 100644 --- a/_site/js/writes/nested.html +++ b/_site/js/writes/nested.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/_site/js/writes/validations.html b/_site/js/writes/validations.html index 747848e..cde9db6 100644 --- a/_site/js/writes/validations.html +++ b/_site/js/writes/validations.html @@ -121,6 +121,7 @@

  • Authentication
  • State Syncing
  • Data Down, Actions Up
  • +
  • Extra params
  • diff --git a/js/extra-params.md b/js/extra-params.md new file mode 100644 index 0000000..afd46e6 --- /dev/null +++ b/js/extra-params.md @@ -0,0 +1,47 @@ +--- +layout: page +--- + +{% include js-header.html %} +{% include js-toc.html %} + +
    +### Extra Params + +Sometimes you need to submit params that are not standard jsonapi params. One great example would be +`https://yourdomain.com/users?debug=true` which is not a param for the `UserResource` you may have, but +might enable functionality in your controller as needed. + +Invoking it is pretty straightforward, just invoke `extraParams` and pass in params and values you wish +to add to your API call when executed. + + +{% highlight typescript %} +YourRecord.extraParams({ debug: true }) +{% endhighlight %} + +One common way to use this globally is to put this into a base class so it can be chained as part of +every resource. + +{% include js-code-tabs.html %} +
    + {% highlight typescript %} + @Model + export class ApplicationRecord extends SpraypaintBase { + static withDebug(): Scope { + return this.extraParams({ debug: true }) as Scope; + } + } + // unfortunately you will need to pass in the + // implementing class' type as a generic + UserRecord.withDebug().all() + {% endhighlight %} + {% highlight javascript %} + const ApplicationRecord = SpraypaintBase.extend({ + static: { + withDebug: () => this.extraParams({ debug: true }); + } + }) + UserRecord.withDebug().all() + {% endhighlight %} +
    \ No newline at end of file