-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/add_api_usage_nudge
- Loading branch information
Showing
67 changed files
with
2,304 additions
and
737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = (envId) => ` | ||
curl 'https://edge.api.flagsmith.com/api/v1/flags/' | ||
curl 'https://edge.api.flagsmith.com/api/v1/flags/'\\ | ||
-H 'x-environment-key: ${envId}' | ||
` |
5 changes: 5 additions & 0 deletions
5
frontend/common/code-help/offline_client/offline-client-cli.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = (envId) => ` | ||
npm i flagsmith-cli -g | ||
export FLAGSMITH_ENVIRONMENT=${envId} | ||
flagsmith get | ||
` |
4 changes: 4 additions & 0 deletions
4
frontend/common/code-help/offline_client/offline-client-curl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = (envId) => ` | ||
curl 'https://edge.api.flagsmith.com/api/v1/flags/'\\ | ||
-H 'x-environment-key: ${envId}' > flagsmith.json | ||
` |
6 changes: 6 additions & 0 deletions
6
frontend/common/code-help/offline_server/offline-server-cli.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import _data from 'common/data/base/_data' | ||
module.exports = (serversideEnvironmentKey) => ` | ||
npm i flagsmith-cli -g | ||
export FLAGSMITH_ENVIRONMENT=${serversideEnvironmentKey} | ||
flagsmith get -e document | ||
` |
4 changes: 4 additions & 0 deletions
4
frontend/common/code-help/offline_server/offline-server-curl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = (serversideEnvironmentKey) => ` | ||
curl 'https://edge.api.flagsmith.com/api/v1/environment-document/'\\ | ||
-H 'x-environment-key: ${serversideEnvironmentKey}' > flagsmith.json | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Res } from 'common/types/responses' | ||
import { Req } from 'common/types/requests' | ||
import { service } from 'common/service' | ||
|
||
export const featureVersioningService = service | ||
.enhanceEndpoints({ addTagTypes: ['FeatureVersioning'] }) | ||
.injectEndpoints({ | ||
endpoints: (builder) => ({ | ||
enableFeatureVersioning: builder.mutation< | ||
Res['enableFeatureVersioning'], | ||
Req['enableFeatureVersioning'] | ||
>({ | ||
invalidatesTags: [{ id: 'LIST', type: 'FeatureVersioning' }], | ||
query: (query: Req['enableFeatureVersioning']) => ({ | ||
body: query, | ||
method: 'POST', | ||
url: `environments/${query.environmentId}/enable-v2-versioning/`, | ||
}), | ||
}), | ||
// END OF ENDPOINTS | ||
}), | ||
}) | ||
|
||
export async function enableFeatureVersioning( | ||
store: any, | ||
data: Req['enableFeatureVersioning'], | ||
options?: Parameters< | ||
typeof featureVersioningService.endpoints.enableFeatureVersioning.initiate | ||
>[1], | ||
) { | ||
return store.dispatch( | ||
featureVersioningService.endpoints.enableFeatureVersioning.initiate( | ||
data, | ||
options, | ||
), | ||
) | ||
} | ||
// END OF FUNCTION_EXPORTS | ||
|
||
export const { | ||
useEnableFeatureVersioningMutation, | ||
// END OF EXPORTS | ||
} = featureVersioningService | ||
|
||
/* Usage examples: | ||
const { data, isLoading } = useGetFeatureVersioningQuery({ id: 2 }, {}) //get hook | ||
const [enableFeatureVersioning, { isLoading, data, isSuccess }] = useEnableFeatureVersioningMutation() //create hook | ||
featureVersioningService.endpoints.getFeatureVersioning.select({id: 2})(store.getState()) //access data from any function | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Res } from 'common/types/responses' | ||
import { Req } from 'common/types/requests' | ||
import { service } from 'common/service' | ||
|
||
export const featureSegmentService = service | ||
.enhanceEndpoints({ addTagTypes: ['FeatureSegment'] }) | ||
.injectEndpoints({ | ||
endpoints: (builder) => ({ | ||
deleteFeatureSegment: builder.mutation< | ||
Res['featureSegment'], | ||
Req['deleteFeatureSegment'] | ||
>({ | ||
invalidatesTags: [{ id: 'LIST', type: 'FeatureSegment' }], | ||
query: (query: Req['deleteFeatureSegment']) => ({ | ||
body: query, | ||
method: 'DELETE', | ||
url: `features/feature-segments/${query.id}/`, | ||
}), | ||
}), | ||
// END OF ENDPOINTS | ||
}), | ||
}) | ||
|
||
export async function deleteFeatureSegment( | ||
store: any, | ||
data: Req['deleteFeatureSegment'], | ||
options?: Parameters< | ||
typeof featureSegmentService.endpoints.deleteFeatureSegment.initiate | ||
>[1], | ||
) { | ||
return store.dispatch( | ||
featureSegmentService.endpoints.deleteFeatureSegment.initiate( | ||
data, | ||
options, | ||
), | ||
) | ||
} | ||
// END OF FUNCTION_EXPORTS | ||
|
||
export const { | ||
useDeleteFeatureSegmentMutation, | ||
// END OF EXPORTS | ||
} = featureSegmentService | ||
|
||
/* Usage examples: | ||
const { data, isLoading } = useGetFeatureSegmentQuery({ id: 2 }, {}) //get hook | ||
const [createFeatureSegment, { isLoading, data, isSuccess }] = useCreateFeatureSegmentMutation() //create hook | ||
featureSegmentService.endpoints.getFeatureSegment.select({id: 2})(store.getState()) //access data from any function | ||
*/ |
Oops, something went wrong.