From a9b008668a44ce2e16012d80cf8579de9562e783 Mon Sep 17 00:00:00 2001 From: Flow Date: Thu, 30 Jun 2022 18:39:29 +0100 Subject: [PATCH 1/2] feature: Change block codes to jsonc --- _includes/android/objects.md | 12 ++++-- _includes/arduino/objects.md | 11 ++++- _includes/cloudcode/cloud-code-advanced.md | 22 +++++----- _includes/cloudcode/cloud-code.md | 6 +-- _includes/common/data.md | 4 +- _includes/common/security.md | 6 +-- _includes/dotnet/objects.md | 12 ++++-- _includes/graphql/classes.md | 4 +- _includes/graphql/customisation.md | 24 +++++------ _includes/graphql/files.md | 16 ++++---- _includes/graphql/health-check.md | 4 +- _includes/graphql/objects.md | 16 ++++---- _includes/graphql/queries.md | 40 +++++++++---------- _includes/graphql/users.md | 28 ++++++------- _includes/ios/objects.md | 12 ++++-- _includes/js/objects.md | 12 ++++-- _includes/js/users.md | 4 +- .../parse-server/deploying-aws-ubuntu.md | 4 +- _includes/parse-server/file-adapters.md | 2 +- _includes/parse-server/getting-started.md | 6 +-- _includes/parse-server/push-notifications.md | 25 +++++++++++- _includes/parse-server/third-party-auth.md | 40 +++++++++---------- _includes/php/installation.md | 2 +- _includes/php/objects.md | 12 ++++-- _includes/php/setup.md | 4 +- _includes/rest/config.md | 4 +- _includes/rest/files.md | 2 +- _includes/rest/geopoints.md | 2 +- _includes/rest/hooks.md | 2 +- _includes/rest/objects.md | 22 +++++----- _includes/rest/push-notifications.md | 6 +-- _includes/rest/queries.md | 8 ++-- _includes/rest/quick-reference.md | 2 +- _includes/rest/roles.md | 6 +-- _includes/rest/schemas.md | 2 +- _includes/rest/users.md | 26 ++++++------ _includes/unity/objects.md | 14 +++++-- 37 files changed, 244 insertions(+), 180 deletions(-) diff --git a/_includes/android/objects.md b/_includes/android/objects.md index b1c0071f5..b101e9c07 100644 --- a/_includes/android/objects.md +++ b/_includes/android/objects.md @@ -28,9 +28,15 @@ gameScore.saveInBackground(); After this code runs, you will probably be wondering if anything really happened. To make sure the data was saved, you can look at the Data Browser in your app on Parse. You should see something like this: -```javascript -objectId: "xWMyZ4YEGZ", score: 1337, playerName: "Sean Plott", cheatMode: false, -createdAt:"2022-01-01T12:23:45.678Z", updatedAt:"2022-01-01T12:23:45.678Z" +```jsonc +{ + "objectId": "xWMyZ4YEGZ", + "score": 1337, + "playerName": "Sean Plott", + "cheatMode": false, + "createdAt":"2022-01-01T12:23:45.678Z", + "updatedAt":"2022-01-01T12:23:45.678Z" +} ``` There are two things to note here. You didn't have to configure or set up a new Class called `GameScore` before running this code. Your Parse app lazily creates this Class for you when it first encounters it. diff --git a/_includes/arduino/objects.md b/_includes/arduino/objects.md index 32fda3ee7..138ea34d5 100644 --- a/_includes/arduino/objects.md +++ b/_includes/arduino/objects.md @@ -35,8 +35,15 @@ response.close(); // Free the resource After this code runs, you will probably be wondering if anything really happened. To make sure the data was saved, you can look at the Data Browser in your app on Parse. You should see something like this: -```javascript - objectId: "xWMyZ4YEGZ", temperature: 175.0, leverDown: true, createdAt: "2022-01-01T12:23:45.678Z", updatedAt: "2022-01-01T12:23:45.678Z" +```jsonc +{ + "objectId": "xWMyZ4YEGZ", + "score": 1337, + "playerName": "Sean Plott", + "cheatMode": false, + "createdAt":"2022-01-01T12:23:45.678Z", + "updatedAt":"2022-01-01T12:23:45.678Z" +} ``` There are two things to note here. You didn't have to configure or set up a new Class called `Temperature` before running this code. Your Parse app lazily creates this Class for you when it first encounters it. diff --git a/_includes/cloudcode/cloud-code-advanced.md b/_includes/cloudcode/cloud-code-advanced.md index c525e3d74..2aefc128f 100644 --- a/_includes/cloudcode/cloud-code-advanced.md +++ b/_includes/cloudcode/cloud-code-advanced.md @@ -206,7 +206,7 @@ end Here's an example of the JSON data that would be sent in the request to this webhook: -```json +```jsonc // Sent to webhook { "master": false, @@ -225,14 +225,14 @@ Here's an example of the JSON data that would be sent in the request to this web This response would indicate a success in the webhook: -```json +```jsonc // Returned from the webhook on success { "success": "Hello World!" } ``` This response would indicate an error in the webhook: -```json +```jsonc // Returned from the webhook on error { "error": "Error message >:(" } ``` @@ -275,7 +275,7 @@ end Here's an example of the JSON data that would be sent in the request to this webhook: -```json +```jsonc // Sent to webhook { "master": true, @@ -287,7 +287,7 @@ Here's an example of the JSON data that would be sent in the request to this web This response would indicate a success in the webhook: -```json +```jsonc // Returned from the webhook on success { "success": "User billed!" } ``` @@ -310,7 +310,7 @@ For triggers, the following parameters are sent to your webhook. To respond to a `beforeSave` request, send a JSON object with the key `error` or `success` set. This is the same as for Cloud functions, but there's an extra capability with `beforeSave` triggers. By returning an error, you will cancel the save request and the object will not be stored on Parse. You can also return a JSON object in this following format to override the values that will be saved for the object: -```json +```jsonc { "className": "AwesomeClass", "existingColumn": "sneakyChange", @@ -348,7 +348,7 @@ end Here's an example of the JSON data that would be sent in the request to this webhook: -```json +```jsonc // Sent to webhook { "master": false, @@ -419,7 +419,7 @@ end Here's an example of the JSON data that would be sent in the request to this webhook: -```json +```jsonc // Sent to webhook { "master": false, @@ -485,7 +485,7 @@ end Here's an example of the JSON data that would be sent in the request to this webhook: -```json +```jsonc // Sent to webhook { "master": false, @@ -509,7 +509,7 @@ Here's an example of the JSON data that would be sent in the request to this web This response would indicate a success in the webhook: -```json +```jsonc // Returned from the webhook on success { "success": true } ``` @@ -554,7 +554,7 @@ end Here's an example of the JSON data that would be sent in the request to this webhook: -```json +```jsonc // Sent to webhook { "master": false, diff --git a/_includes/cloudcode/cloud-code.md b/_includes/cloudcode/cloud-code.md index 73995a604..abe4b96be 100644 --- a/_includes/cloudcode/cloud-code.md +++ b/_includes/cloudcode/cloud-code.md @@ -2,7 +2,7 @@ Let's look at a slightly more complex example where Cloud Code is useful. One reason to do computation in the cloud is so that you don't have to send a huge list of objects down to a device if you only want a little bit of information. For example, let's say you're writing an app that lets people review movies. A single `Review` object could look like: -```json +```jsonc { "movie": "The Matrix", "stars": 5, @@ -112,13 +112,13 @@ In general, two arguments will be passed into cloud functions: If the function is successful, the response in the client looks like: -```json +```jsonc { "result": 4.8 } ``` If there is an error, the response in the client looks like: -```json +```jsonc { "code": 141, "error": "movie lookup failed" diff --git a/_includes/common/data.md b/_includes/common/data.md index 413b28cdb..a705c3e02 100644 --- a/_includes/common/data.md +++ b/_includes/common/data.md @@ -36,7 +36,7 @@ You may import data into your Parse app by using CSV or JSON files. To create a The JSON format is an array of objects in our REST format or a JSON object with a `results` that contains an array of objects. It must adhere to the [JSON standard](http://json.org/). A file containing regular objects could look like: -```js +```jsonc { "results": [ { "score": 1337, @@ -63,7 +63,7 @@ In addition to the exposed fields, objects in the Parse User class can also have A file containing a `User` object could look like: -```js +```jsonc { "results": [{ "username": "cooldude", diff --git a/_includes/common/security.md b/_includes/common/security.md index cd327b8a8..250288f31 100644 --- a/_includes/common/security.md +++ b/_includes/common/security.md @@ -389,7 +389,7 @@ All this is just the beginning. Applications can enforce all sorts of complex ac For the curious, here's the format for an ACL that restricts read and write permissions to the owner (whose `objectId` is identified by `"aSaMpLeUsErId"`) and enables other users to read the object: -```json +```jsonc { "*": { "read":true }, "aSaMpLeUsErId": { "read" :true, "write": true } @@ -398,7 +398,7 @@ For the curious, here's the format for an ACL that restricts read and write perm And here's another example of the format of an ACL that uses a Role: -```json +```jsonc { "role:RoleName": { "read": true }, "aSaMpLeUsErId": { "read": true, "write": true } @@ -413,7 +413,7 @@ Given that objects often already have pointers to the user(s) that should have p Pointer permissions are like virtual ACLs. They don't appear in the ACL column, but if you are familiar with how ACLs work, you can think of them like ACLs. In the above example with the `sender` and `receiver`, each object will act as if it has an ACL of: -```json +```jsonc { "": { "read": true, diff --git a/_includes/dotnet/objects.md b/_includes/dotnet/objects.md index a99d3b7c5..b8b464ae3 100644 --- a/_includes/dotnet/objects.md +++ b/_includes/dotnet/objects.md @@ -28,9 +28,15 @@ await gameScore.SaveAsync(); After this code runs, you will probably be wondering if anything really happened. To make sure the data was saved, you can look at the Data Browser in your app on Parse. You should see something like this: -```javascript -objectId: "xWMyZ4YEGZ", score: 1337, playerName: "Sean Plott", cheatMode: false, -createdAt:"2022-01-01T12:23:45.678Z", updatedAt:"2022-01-01T12:23:45.678Z" +```jsonc +{ + "objectId": "xWMyZ4YEGZ", + "score": 1337, + "playerName": "Sean Plott", + "cheatMode": false, + "createdAt":"2022-01-01T12:23:45.678Z", + "updatedAt":"2022-01-01T12:23:45.678Z" +} ``` There are two things to note here. You didn't have to configure or set up a new Class called `GameScore` before running this code. Your Parse app lazily creates this Class for you when it first encounters it. diff --git a/_includes/graphql/classes.md b/_includes/graphql/classes.md index 83035d6be..83945577a 100644 --- a/_includes/graphql/classes.md +++ b/_includes/graphql/classes.md @@ -1,7 +1,7 @@ # Classes Since your application does not have a schema yet, you can use the `createClass` mutation to create your first class through the GraphQL API. Run the following: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -34,7 +34,7 @@ mutation createGameScoreClass { } } ``` -```js +```jsonc // Response { "data": { diff --git a/_includes/graphql/customisation.md b/_includes/graphql/customisation.md index 944314315..c3479170b 100644 --- a/_includes/graphql/customisation.md +++ b/_includes/graphql/customisation.md @@ -109,7 +109,7 @@ By default, all of your Parse classes, including the defaults such as `Parse.Use In the following example, we limit our GraphQL schema to only expose the default `_User` class, along with a few custom classes: -```javascript +```jsonc { "enabledForClasses": ["_User", "Book", "Review", "Comment"], "disabledForClasses": null @@ -133,7 +133,7 @@ By default, we enrich the schema by generating a number of [Input Types](https:/ In the following example, we have a custom class called `Review` where the fields `rating` and `body` are allowed on the `create` mutation, and the field `numberOfLikes` on the `update` mutation: -```javascript +```jsonc { "classConfigs": [ { @@ -151,7 +151,7 @@ In the following example, we have a custom class called `Review` where the field You may decide to restrict which fields can be resolved when getting or finding records from a given class, for example, if you have a class called `Video` which includes a sensitive field `dmcaFlags`, you can hide this field by explicitly stating the fields that can be resolved: -```javascript +```jsonc { "classConfigs": [ { @@ -169,7 +169,7 @@ In production-grade environments where performance optimisation is critical, com In the following example, we set the fields `name` and `age` as the only two that can be used to filter the `_User` class, and defining the `createdAt` and `age` fields the only sortable field whilst disabling the ascending direction on the `createdAt` field: -```javascript +```jsonc { "classConfigs": [ { @@ -199,7 +199,7 @@ In the following example, we set the fields `name` and `age` as the only two tha By default, the schema exposes a `get` and `find` operation for each class, for example, `get_User` and `find_User`. You can disable either of these for any class in your schema, like so: -```javascript +```jsonc { "classConfigs": [ { @@ -222,7 +222,7 @@ By default, the schema exposes a `get` and `find` operation for each class, for By default, generated query names use pluralized version of `className`. You can override this behaviour with `getAlias`/`findAlias`. This is useful when your collection is named in plural or when singular/plural forms are same e.g. `Data`: -```javascript +```jsonc { "classConfigs": [ { @@ -246,7 +246,7 @@ By default, generated query names use pluralized version of `className`. You can By default, the schema exposes a `create`, `update` and `delete` operation for each class, for example, `create_User`, `update_User` and `delete_User`. You can disable any of these mutations for any class in your schema, like so: -```javascript +```jsonc { "classConfigs": [ { @@ -273,7 +273,7 @@ By default, the schema exposes a `create`, `update` and `delete` operation for e You can optionally override the default generated mutation names with aliases: -```javascript +```jsonc { "classConfigs": [ { @@ -326,7 +326,7 @@ extend type Query { Parse.Cloud.define("hello", () => "Hello, world!"); ``` -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -342,7 +342,7 @@ query hello { The code above should resolve to this: -```js +```jsonc // Response { "data": { @@ -418,7 +418,7 @@ Parse.Cloud.define("addToCart", async (req) => { }); ``` -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -437,7 +437,7 @@ mutation addItemToCart { The code above should resolve to something similar to this: -```js +```jsonc // Response { "data": { diff --git a/_includes/graphql/files.md b/_includes/graphql/files.md index 4c251f1da..b5dc5bedb 100644 --- a/_includes/graphql/files.md +++ b/_includes/graphql/files.md @@ -5,7 +5,7 @@ The GraphQL API supports file upload via [GraphQL Upload](https://github.com/jay ## Add a File field to a Class First of all we will update our `GameScore` class with a `screenshot` field of type `File`. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -29,7 +29,7 @@ mutation updateGameScoreClass { } } ``` -```js +```jsonc // Response { "data": { @@ -46,7 +46,7 @@ mutation updateGameScoreClass { The GraphQL API supports nested mutation for the `File` type, so you can send the file along with the Parse Object or just upload the file and get the returned information. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -65,7 +65,7 @@ mutation createFile($file: Upload!) { } } ``` -```js +```jsonc // Response { "data": { @@ -83,7 +83,7 @@ mutation createFile($file: Upload!) { You can add an existing file to an object. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -116,7 +116,7 @@ mutation createGameScore { } } ``` -```js +```jsonc // Response { "data": { @@ -134,7 +134,7 @@ mutation createGameScore { ## Create and add a file Lets create a new `GameScore` object and upload the file. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -164,7 +164,7 @@ mutation createGameScore($file: Upload! ) { } } ``` -```js +```jsonc // Response { "data": { diff --git a/_includes/graphql/health-check.md b/_includes/graphql/health-check.md index ff56c225d..819a546ca 100644 --- a/_includes/graphql/health-check.md +++ b/_includes/graphql/health-check.md @@ -2,7 +2,7 @@ Now that you have set up your GraphQL environment, it is time to run your first query. Execute the following code in your GraphQL Playground to check your API's health: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -16,7 +16,7 @@ query healthy { health } ``` -```js +```jsonc // Response { "data": { diff --git a/_includes/graphql/objects.md b/_includes/graphql/objects.md index 8881ad98a..c86e7acba 100644 --- a/_includes/graphql/objects.md +++ b/_includes/graphql/objects.md @@ -6,7 +6,7 @@ For each class in your application's schema, Parse Server automatically generate For example, if you have a class named `GameScore` in the schema, Parse Server automatically generates a new mutation called `createGameScore`, and you should be able to run the code below in your GraphQL Playground: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -45,7 +45,7 @@ mutation createAGameScore { } } ``` -```js +```jsonc // Response { "data": { @@ -78,7 +78,7 @@ For each class in your application's schema, Parse Server automatically generate For example, if you have a class named `GameScore` in the schema, Parse Server automatically generates a new mutation called `updateGameScore`. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -101,7 +101,7 @@ mutation updateAGameScore { } } ``` -```js +```jsonc // Response { "data": { @@ -122,7 +122,7 @@ For each class in your application's schema, Parse Server automatically generate For example, if you have a class named `GameScore` in the schema, Parse Server automatically generates a new mutation called `deleteGameScore`. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -143,7 +143,7 @@ mutation deleteAGameScore { The code above should resolve to something similar to this: -```js +```jsonc // Response { "data": { @@ -163,7 +163,7 @@ The code above should resolve to something similar to this: The GraphQL API supports nested mutations, so you can create objects with complex relationships in one request. Assuming that we have classes `Country`, `City` and `Company`. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -208,7 +208,7 @@ mutation aNestedMutation { } } ``` -```js +```jsonc // Response { "data": { diff --git a/_includes/graphql/queries.md b/_includes/graphql/queries.md index 915023d75..9dc656305 100644 --- a/_includes/graphql/queries.md +++ b/_includes/graphql/queries.md @@ -6,7 +6,7 @@ For each class in your application's schema, Parse Server automatically generate For example, if you have a class named `GameScore` in the schema, Parse Server automatically generates a new query called `gameScore`, and you should be able to run the code below in your GraphQL Playground: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -31,7 +31,7 @@ query getAGameScore { } } ``` -```js +```jsonc // Response { "data": { @@ -55,7 +55,7 @@ query getAGameScore { With the Relay specification you also have the choice to use [GraphQL Fragments](https://graphql.org/learn/queries/#fragments) through the `node` GraphQL Query. For a `GameScore` object the following query will do the job. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -77,7 +77,7 @@ query getGameScoreWithNodeRelay { } ``` -```js +```jsonc // Response { "data": { @@ -94,7 +94,7 @@ query getGameScoreWithNodeRelay { Here using `Node Relay` is useful for writing generic requests for your front end components. For example, assuming we already have a `User` with a `Relay Node Id: X1VzZXI6Q1lMeWJYMjFjcw==` and `username: "johndoe"`. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -119,7 +119,7 @@ query genericGet { } } ``` -```js +```jsonc // Response { "data": { @@ -138,7 +138,7 @@ For each class in your application's schema, Parse Server automatically generate For example, if you have a class named `GameScore` in the schema, Parse Server automatically generates a new query called `gameScores`, and you should be able to run the code below in your GraphQL Playground: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -168,7 +168,7 @@ query getSomeGameScores{ } } ``` -```js +```jsonc // Response { "data": { @@ -218,7 +218,7 @@ query getSomeGameScores{ You can use the `where` argument to add constraints to a class find query. See the example below: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -244,7 +244,7 @@ query getSomeGameScores { } } ``` -```js +```jsonc // Response { "data": { @@ -271,7 +271,7 @@ Visit your GraphQL Playground if you want to know all the available constraints. You can use the `order` argument to select in which order the results are returned in a class find query. See the example below: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -300,7 +300,7 @@ query getSomeGameScores { } } ``` -```js +```jsonc // Response { "data": { @@ -346,7 +346,7 @@ You can combine multiple parameters like: `before & last` or `after & first`, as Note: `cursor` is different to `id`, it is a temporary pagination ID for the query. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -376,7 +376,7 @@ query getSomeGameScores { } } ``` -```js +```jsonc // Response { "data": { @@ -410,7 +410,7 @@ query getSomeGameScores { The GraphQL API supports nested queries, so you can find object and then execute query on relational child fields. Assuming that we have classes `Country`, `City`, `Company`: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -440,7 +440,7 @@ query aNestedQuery { } } ``` -```js +```jsonc // Response { "data": { @@ -479,7 +479,7 @@ Let's build a query matching countries that contain at least one city with more The GraphQL API can handle this type of complex relational query with ease. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -524,7 +524,7 @@ The GraphQL API can handle this type of complex relational query with ease. ... too many brackets here } ``` -```js +```jsonc // Response { "data": { @@ -562,7 +562,7 @@ Assuming that we have a `Country` class, `City` class, `Street` class, `House` c Let's build a query matching houses where the street has a city that has a country with a name equal to `France`. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -607,7 +607,7 @@ Let's build a query matching houses where the street has a city that has a count } ``` -```js +```jsonc // Response { "data": { diff --git a/_includes/graphql/users.md b/_includes/graphql/users.md index 5a3c9adf5..80c5e5b7e 100644 --- a/_includes/graphql/users.md +++ b/_includes/graphql/users.md @@ -12,7 +12,7 @@ You can ask Parse Server to [verify user email addresses]({{ site.baseUrl }}/par To sign up a new user, use the `signUp` mutation. For example: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -41,7 +41,7 @@ mutation signUp { } } ``` -```js +```jsonc // Response { "data": { @@ -64,7 +64,7 @@ Note that a field called `sessionToken` has been returned. This token can be use After you allow users to sign up, you need to let them log in to their account with a username and password in the future. To do this, use the `logIn` mutation: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -85,7 +85,7 @@ mutation logIn { } } ``` -```js +```jsonc // Response { "data": { @@ -108,7 +108,7 @@ Note that, when the user logs in, Parse Server generates a new `sessionToken` fo You can log in a user via a [3rd party authentication](https://docs.parseplatform.org/parse-server/guide/#supported-3rd-party-authentications) system (Facebook, Twitter, Apple and many more) with the `logInWith` mutation. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -140,7 +140,7 @@ mutation LoginWithFacebook { } } ``` -```js +```jsonc // Response { "data": { @@ -166,7 +166,7 @@ You can easily do this in the GraphQL Playground. There is an option called `HTT After setting up the `X-Parse-Session-Token` header, any operation will run as this user. For example, you can run the code below to validate the session token and return its associated user: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -185,7 +185,7 @@ query viewer { } } ``` -```js +```jsonc // Response { "data": { @@ -204,7 +204,7 @@ query viewer { You can log out a user through the `logOut` mutation. You need to send the `X-Parse-Session-Token` header and run code like the below example: -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -226,7 +226,7 @@ mutation logOut { } ``` -```js +```jsonc // Response { "data": { @@ -247,7 +247,7 @@ mutation logOut { To use the `resetPassword` mutation your Parse Server must have an email adapter configured. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -261,7 +261,7 @@ mutation resetPassword { } } ``` -```js +```jsonc // Response { "data": { @@ -276,7 +276,7 @@ mutation resetPassword { The verification email is automatically sent on sign up; this mutation is useful if the user didn't receive the first email. Again, an email adapter must be configured for this mutation to work. -```js +```jsonc // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -291,7 +291,7 @@ mutation sendVerificationEmail { } ``` -```js +```jsonc // Response { "data": { diff --git a/_includes/ios/objects.md b/_includes/ios/objects.md index d0e0a33ff..4316cb3be 100644 --- a/_includes/ios/objects.md +++ b/_includes/ios/objects.md @@ -49,9 +49,15 @@ gameScore.saveInBackground { (succeeded, error) in After this code runs, you will probably be wondering if anything really happened. If [Parse Dashboard](https://github.com/parse-community/parse-dashboard) is implemented for your server, you can verify the data was saved in the data browser. You should see something like this: -```js -objectId: "xWMyZ4YEGZ", score: 1337, playerName: "Sean Plott", cheatMode: false, -createdAt:"2022-01-01T12:23:45.678Z", updatedAt:"2022-01-01T12:23:45.678Z" +```jsonc +{ + "objectId": "xWMyZ4YEGZ", + "score": 1337, + "playerName": "Sean Plott", + "cheatMode": false, + "createdAt":"2022-01-01T12:23:45.678Z", + "updatedAt":"2022-01-01T12:23:45.678Z" +} ``` There are two things to note here. You didn't have to configure or set up a new Class called `GameScore` before running this code. Your Parse app lazily creates this Class for you when it first encounters it. diff --git a/_includes/js/objects.md b/_includes/js/objects.md index 39197859f..c8df01b11 100644 --- a/_includes/js/objects.md +++ b/_includes/js/objects.md @@ -144,9 +144,15 @@ gameScore.save() After this code runs, you will probably be wondering if anything really happened. To make sure the data was saved, you can look at the Data Browser in your app on Parse. You should see something like this: -```json -objectId: "xWMyZ4YEGZ", score: 1337, playerName: "Sean Plott", cheatMode: false, -createdAt:"2022-01-01T12:23:45.678Z", updatedAt:"2022-01-01T12:23:45.678Z" +```jsonc +{ + "objectId": "xWMyZ4YEGZ", + "score": 1337, + "playerName": "Sean Plott", + "cheatMode": false, + "createdAt":"2022-01-01T12:23:45.678Z", + "updatedAt":"2022-01-01T12:23:45.678Z" +} ``` There are two things to note here. You didn't have to configure or set up a new Class called `GameScore` before running this code. Your Parse app lazily creates this Class for you when it first encounters it. diff --git a/_includes/js/users.md b/_includes/js/users.md index 514c19dec..533212622 100644 --- a/_includes/js/users.md +++ b/_includes/js/users.md @@ -414,7 +414,7 @@ Location: https://YOUR.PARSE-SERVER.HERE/parse/users/uMz0YZeAqc With a response body like: -```json +```jsonc { "username": "Parse", "createdAt": "2022-01-01T12:23:45.678Z", @@ -436,7 +436,7 @@ Location: https://YOUR.PARSE-SERVER.HERE/parse/users/uMz0YZeAqc ``` The body of the response will contain the `objectId`, `createdAt`, `sessionToken`, and an automatically-generated unique `username`. For example: -```json +```jsonc { "username": "iwz8sna7sug28v4eyu7t89fij", "createdAt": "2022-01-01T12:23:45.678Z", diff --git a/_includes/parse-server/deploying-aws-ubuntu.md b/_includes/parse-server/deploying-aws-ubuntu.md index 2caf2c2f5..3e969d8db 100644 --- a/_includes/parse-server/deploying-aws-ubuntu.md +++ b/_includes/parse-server/deploying-aws-ubuntu.md @@ -118,7 +118,7 @@ After that, we need to setup the configuration file, use your own `appId`, `mast sudo nano -w config.json ``` This are the basic options of the config.json file, for the full list you can type `parse-server --help` or refer to the [full options document](https://parseplatform.org/parse-server/api/5.2.0/ParseServerOptions.html) for more details. -```js +```jsonc { "appId": "exampleAppId", "masterKey": "exampleMasterKey", @@ -158,7 +158,7 @@ Once installed, you need to configure Parse Dashboard, go to `/usr/lib/node_modu sudo nano -w parse-dashboard-config.json ``` This is an example of parse-dashboard.config.json. -```js +```jsonc { "apps": [{ "serverURL": "http://example.com:1337/parse", diff --git a/_includes/parse-server/file-adapters.md b/_includes/parse-server/file-adapters.md index 336d31155..2764efef0 100644 --- a/_includes/parse-server/file-adapters.md +++ b/_includes/parse-server/file-adapters.md @@ -110,7 +110,7 @@ First you will create a bucket in S3 to hold these files. 8. Now select the **Policies** tab, then **Create Policy**. 9. Select **Create Your Own Policy**, fill out a **Policy Name**. 10. Copy the following config in **Policy Document**, changing **BUCKET_NAME** for the name of the bucket you created earlier. (note: this is a little more permissive than Parse Server needs, but it works for now) - ```js + ```jsonc { "Version": "2012-10-17", "Statement": [ diff --git a/_includes/parse-server/getting-started.md b/_includes/parse-server/getting-started.md index 7080e9be3..1ed5a2eb5 100644 --- a/_includes/parse-server/getting-started.md +++ b/_includes/parse-server/getting-started.md @@ -45,7 +45,7 @@ http://localhost:1337/parse/classes/GameScore You should get a response similar to this: -```js +```jsonc { "objectId": "2ntvSpRGIK", "createdAt": "2022-01-01T12:23:45.678Z" @@ -60,7 +60,7 @@ curl -X GET \ http://localhost:1337/parse/classes/GameScore/2ntvSpRGIK ``` -```js +```jsonc // Response { "objectId": "2ntvSpRGIK", @@ -80,7 +80,7 @@ curl -X GET \ http://localhost:1337/parse/classes/GameScore ``` -```js +```jsonc // The response will provide all the matching objects within the `results` array: { "results": [ diff --git a/_includes/parse-server/push-notifications.md b/_includes/parse-server/push-notifications.md index 26e8880a8..afaecf14a 100644 --- a/_includes/parse-server/push-notifications.md +++ b/_includes/parse-server/push-notifications.md @@ -237,9 +237,30 @@ After sending this to your Parse Server, you should see the push notifications s In your Parse Server logs, you can see something similar to -```js +```jsonc // FCM request and response -{"request":{"params":{"priority":"normal","data":{"time":"2022-01-01T12:23:45.678Z","push_id":"NTDgWw7kp8","data":"{\"alert\":\"All work and no play makes Jack a dull boy.\"}"}}},"response":{"multicast_id":5318039027588186000,"success":1,"failure":0,"canonical_ids":0,"results":[{"registration_id":"APA91bEdLpZnXT76vpkvkD7uWXEAgfrZgkiH_ybkzXqhaNcRw1KHOY0s9GUKNgneGxe2PqJ5Swk1-Vf852kpHAP0Mhoj5wd1MVXpRsRr_3KTQo_dkNd_5wcQ__yWnWLxbeM3kg_JziJK","message_id":"0:1455074519347821%df0f8ea7f9fd7ecd"}]}} +{ + "request": { + "params": { + "priority": "normal", + "data": { + "time": "2022-01-01T12:23:45.678Z", + "push_id": "NTDgWw7kp8", + "data": "{\"alert\":\"All work and no play makes Jack a dull boy.\"}" + } + } + }, + "response": { + "multicast_id": 5318039027588186000, + "success": 1, + "failure": 0, + "canonical_ids": 0, + "results": [{ + "registration_id": "APA91bEdLpZnXT76vpkvkD7uWXEAgfrZgkiH_ybkzXqhaNcRw1KHOY0s9GUKNgneGxe2PqJ5Swk1-Vf852kpHAP0Mhoj5wd1MVXpRsRr_3KTQo_dkNd_5wcQ__yWnWLxbeM3kg_JziJK", + "message_id": "0:1455074519347821%df0f8ea7f9fd7ecd" + }] + } +} ``` ```sh diff --git a/_includes/parse-server/third-party-auth.md b/_includes/parse-server/third-party-auth.md index 9682e815b..ef52d9aef 100644 --- a/_includes/parse-server/third-party-auth.md +++ b/_includes/parse-server/third-party-auth.md @@ -50,7 +50,7 @@ Note, most of them don't require a server configuration so you can use them dire ### Facebook `authData` -```js +```jsonc { "facebook": { "id": "user's Facebook id number as a string", @@ -63,7 +63,7 @@ Learn more about [Facebook login](https://developers.facebook.com/docs/authentic ### Twitter `authData` -```js +```jsonc { "twitter": { "id": "user's Twitter id number as a string", @@ -91,7 +91,7 @@ Learn more about [Twitter login](https://developer.twitter.com/en/docs/twitter-f ### Anonymous user `authData` -```js +```jsonc { "anonymous": { "id": "random UUID with lowercase hexadecimal digits" @@ -103,7 +103,7 @@ Learn more about [Twitter login](https://developer.twitter.com/en/docs/twitter-f As of Parse Server 3.5.0 you can use [Sign In With Apple](https://developer.apple.com/sign-in-with-apple/get-started/). -```js +```jsonc { "apple": { "id": "user", @@ -131,7 +131,7 @@ Learn more about [Sign In With Apple](https://developer.okta.com/blog/2019/06/04 ### Github `authData` -```js +```jsonc { "github": { "id": "user's Github id (string)", @@ -144,7 +144,7 @@ Learn more about [Sign In With Apple](https://developer.okta.com/blog/2019/06/04 Google oauth supports validation of id_token's and access_token's. -```js +```jsonc { "google": { "id": "user's Google id (string)", @@ -156,7 +156,7 @@ Google oauth supports validation of id_token's and access_token's. ### Instagram `authData` -```js +```jsonc { "instagram": { "id": "user's Instagram id (string)", @@ -168,7 +168,7 @@ Google oauth supports validation of id_token's and access_token's. ### Keycloak `authData` -```js +```jsonc { "keycloak": { "access_token": "access token from keycloak JS client authentication", @@ -205,7 +205,7 @@ The query should return all groups which the user is a member of. The `cn` attri To build a query which works with your LDAP server, you can use a LDAP client like [Apache Directory Studio](https://directory.apache.org/studio/). -```js +```jsonc { "ldap": { "url": "ldap://host:port", @@ -221,7 +221,7 @@ If either `groupCN` or `groupFilter` is not specified, the group check is not pe Example Configuration (this works with the public LDAP test server hosted by Forumsys): -```js +```jsonc { "ldap": { "url": "ldap://ldap.forumsys.com:389", @@ -235,7 +235,7 @@ Example Configuration (this works with the public LDAP test server hosted by For authData: -```js +```jsonc { "authData": { "ldap": { @@ -248,7 +248,7 @@ authData: ### LinkedIn `authData` -```js +```jsonc { "linkedin": { "id": "user's LinkedIn id (string)", @@ -260,7 +260,7 @@ authData: ### Meetup `authData` -```js +```jsonc { "meetup": { "id": "user's Meetup id (string)", @@ -271,7 +271,7 @@ authData: ### Microsoft Graph `authData` -```js +```jsonc { "microsoft": { "id": "user's microsoft id (string)", // required @@ -289,7 +289,7 @@ To [get access on behalf of a user](https://docs.microsoft.com/en-us/graph/auth- As of Parse Server 3.7.0 you can use [PhantAuth](https://www.phantauth.net/). -```js +```jsonc { "phantauth": { "id": "user's PhantAuth sub (string)", @@ -302,7 +302,7 @@ Learn more about [PhantAuth](https://www.phantauth.net/). ### QQ `authData` -```js +```jsonc { "qq": { "id": "user's QQ id (string)", @@ -313,7 +313,7 @@ Learn more about [PhantAuth](https://www.phantauth.net/). ### Spotify `authData` -```js +```jsonc { "spotify": { "id": "user's spotify id (string)", @@ -324,7 +324,7 @@ Learn more about [PhantAuth](https://www.phantauth.net/). ### vKontakte `authData` -```js +```jsonc { "vkontakte": { "id": "user's vkontakte id (string)", @@ -348,7 +348,7 @@ Learn more about [PhantAuth](https://www.phantauth.net/). ### WeChat `authData` -```js +```jsonc { "wechat": { "id": "user's wechat id (string)", @@ -359,7 +359,7 @@ Learn more about [PhantAuth](https://www.phantauth.net/). ### Weibo `authData` -```js +```jsonc { "weibo": { "id": "user's weibo id (string)", diff --git a/_includes/php/installation.md b/_includes/php/installation.md index 12dcd04a4..5aaa1b414 100644 --- a/_includes/php/installation.md +++ b/_includes/php/installation.md @@ -8,7 +8,7 @@ Note that the Parse PHP SDK requires PHP 5.4 or newer. It can also run on HHVM ( [Get Composer], the PHP package manager. Then create a composer.json file in your projects root folder, containing: -```json +```jsonc { "require": { "parse/php-sdk" : "1.4.*" diff --git a/_includes/php/objects.md b/_includes/php/objects.md index 0df1490cd..7b06bb93e 100644 --- a/_includes/php/objects.md +++ b/_includes/php/objects.md @@ -35,9 +35,15 @@ try { After this code runs, you will probably be wondering if anything really happened. To make sure the data was saved, you can look at the Data Browser in your app on Parse. You should see something like this: -```json -objectId: "xWMyZ4YEGZ", score: 1337, playerName: "Sean Plott", cheatMode: false, -createdAt:"2022-01-01T12:23:45.678Z", updatedAt:"2022-01-01T12:23:45.678Z" +```jsonc +{ + "objectId": "xWMyZ4YEGZ", + "score": 1337, + "playerName": "Sean Plott", + "cheatMode": false, + "createdAt":"2022-01-01T12:23:45.678Z", + "updatedAt":"2022-01-01T12:23:45.678Z" +} ``` There are two things to note here. You didn't have to configure or set up a new Class called `GameScore` before running this code. Your Parse app lazily creates this Class for you when it first encounters it. diff --git a/_includes/php/setup.md b/_includes/php/setup.md index 4d7cbe667..070798e15 100644 --- a/_includes/php/setup.md +++ b/_includes/php/setup.md @@ -46,7 +46,7 @@ if($health['status'] === 200) { If you wanted to analyze it further the health response may look something like this. -```json +```jsonc { "status" : 200, "response" : { @@ -62,7 +62,7 @@ Note that it is _not_ guaranteed that 'response' will be a parsable json array. A couple examples of bad health responses could include an incorrect mount path, port or domain. -```json +```jsonc // ParseClient::setServerURL('http://localhost:1337', 'not-good'); { "status": 404, diff --git a/_includes/rest/config.md b/_includes/rest/config.md index 931745995..29587462a 100644 --- a/_includes/rest/config.md +++ b/_includes/rest/config.md @@ -28,7 +28,7 @@ print result The response body is a JSON object containing all the configuration parameters in the `params` field. -```json +```jsonc { "params": { "welcomeMessage": "Welcome to The Internet!", @@ -65,7 +65,7 @@ return request({ The response body is a JSON object containing a simple boolean value in the `result` field. -```json +```jsonc { "result": true } diff --git a/_includes/rest/files.md b/_includes/rest/files.md index 1fa321e14..1022ed7b5 100644 --- a/_includes/rest/files.md +++ b/_includes/rest/files.md @@ -36,7 +36,7 @@ Location: http://files.parsetfss.com/bc9f32df-2957-4bb1-93c9-ec47d9870a05/tfss-d The response body is a JSON object containing the `name` of the file, which is the original file name prefixed with a unique identifier in order to prevent name collisions. This means you can save files with the same name, and the files will not overwrite one another. -```json +```jsonc { "url": "http://files.parsetfss.com/bc9f32df-2957-4bb1-93c9-ec47d9870a05/tfss-db295fb2-8a8b-49f3-aad3-dd911142f64f-hello.txt", "name": "db295fb2-8a8b-49f3-aad3-dd911142f64f-hello.txt" diff --git a/_includes/rest/geopoints.md b/_includes/rest/geopoints.md index a8bd05c1d..18addebf2 100644 --- a/_includes/rest/geopoints.md +++ b/_includes/rest/geopoints.md @@ -87,7 +87,7 @@ print result This will return a list of results ordered by distance from 30.0 latitude and -20.0 longitude. The first result will be the nearest object. (Note that if an explicit `order` parameter is supplied, it will take precedence over the distance ordering.) For example, here are two results returned for the above query: -```json +```jsonc { "results": [ { diff --git a/_includes/rest/hooks.md b/_includes/rest/hooks.md index 6fe19762a..417dc1aaf 100644 --- a/_includes/rest/hooks.md +++ b/_includes/rest/hooks.md @@ -219,7 +219,7 @@ and perform a `parse deploy` the usual way. ## Create function webhook To create a new function webhook post to /parse/hooks/functions with payload in the format -```json +```jsonc {"functionName" : x, "url" : y} ``` diff --git a/_includes/rest/objects.md b/_includes/rest/objects.md index 678d1bdc2..cadebea36 100644 --- a/_includes/rest/objects.md +++ b/_includes/rest/objects.md @@ -6,7 +6,7 @@ Storing data through the Parse REST API is built around a JSON encoding of the o For example, let's say you're tracking high scores for a game. A single object could contain: -```json +```jsonc { "score": 1337, "playerName": "Sean Plott", @@ -20,7 +20,7 @@ Each object has a class name that you can use to distinguish different sorts of When you retrieve objects from Parse, some fields are automatically added: `createdAt`, `updatedAt`, and `objectId`. These field names are reserved, so you cannot set them yourself. The object above could look like this when retrieved: -```json +```jsonc { "score": 1337, "playerName": "Sean Plott", @@ -92,7 +92,7 @@ Location: https://https://https://https://https://https:// Date: Sat, 2 Jul 2022 11:03:31 +0100 Subject: [PATCH 2/2] chore: change indentation to 2 spaces --- _includes/parse-server/push-notifications.md | 42 ++++++++++---------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/_includes/parse-server/push-notifications.md b/_includes/parse-server/push-notifications.md index afaecf14a..d0578f918 100644 --- a/_includes/parse-server/push-notifications.md +++ b/_includes/parse-server/push-notifications.md @@ -240,26 +240,28 @@ In your Parse Server logs, you can see something similar to ```jsonc // FCM request and response { - "request": { - "params": { - "priority": "normal", - "data": { - "time": "2022-01-01T12:23:45.678Z", - "push_id": "NTDgWw7kp8", - "data": "{\"alert\":\"All work and no play makes Jack a dull boy.\"}" - } - } - }, - "response": { - "multicast_id": 5318039027588186000, - "success": 1, - "failure": 0, - "canonical_ids": 0, - "results": [{ - "registration_id": "APA91bEdLpZnXT76vpkvkD7uWXEAgfrZgkiH_ybkzXqhaNcRw1KHOY0s9GUKNgneGxe2PqJ5Swk1-Vf852kpHAP0Mhoj5wd1MVXpRsRr_3KTQo_dkNd_5wcQ__yWnWLxbeM3kg_JziJK", - "message_id": "0:1455074519347821%df0f8ea7f9fd7ecd" - }] - } + "request": { + "params": { + "priority": "normal", + "data": { + "time": "2022-01-01T12:23:45.678Z", + "push_id": "NTDgWw7kp8", + "data": "{\"alert\":\"All work and no play makes Jack a dull boy.\"}" + } + } + }, + "response": { + "multicast_id": 5318039027588186000, + "success": 1, + "failure": 0, + "canonical_ids": 0, + "results": [ + { + "registration_id": "APA91bEdLpZnXT76vpkvkD7uWXEAgfrZgkiH_ybkzXqhaNcRw1KHOY0s9GUKNgneGxe2PqJ5Swk1-Vf852kpHAP0Mhoj5wd1MVXpRsRr_3KTQo_dkNd_5wcQ__yWnWLxbeM3kg_JziJK", + "message_id": "0:1455074519347821%df0f8ea7f9fd7ecd" + } + ] + } } ```